Hi,

When I have a parent and child pom, and both have an antrun plugin entry, I notice that activated anttask run twice.
See attached poms and the output below.

My directory structure:
parent/
--------/pom.xml
--------/child
---------------/pom.xml



Is this behaviour intended? How should I change my poms?

Thanks

Martin


mvn test
[INFO] Scanning for projects...
[INFO] -------------------------------------------------------------------------
---
[INFO] Building child
[INFO]    task-segment: [test]
[INFO] -------------------------------------------------------------------------
---
[INFO] [antrun:run {execution: test1}]
[INFO] Executing tasks
    [echo] test1
[INFO] Executed tasks
[INFO] [antrun:run {execution: childTest1}]
[INFO] Executing tasks
    [echo] childTest1
[INFO] Executed tasks
[INFO] [antrun:run {execution: test1}]
[INFO] Executing tasks
    [echo] test1
[INFO] Executed tasks
[INFO] [antrun:run {execution: childTest1}]
[INFO] Executing tasks
    [echo] childTest1
[INFO] Executed tasks
[INFO] [antrun:run {execution: test3}]
[INFO] Executing tasks
    [echo] test3
[INFO] Executed tasks
[INFO] [antrun:run {execution: childTest3}]
[INFO] Executing tasks
    [echo] childTest3
[INFO] Executed tasks
[INFO] [antrun:run {execution: test3}]
[INFO] Executing tasks
    [echo] test3
[INFO] Executed tasks
[INFO] [antrun:run {execution: childTest3}]
[INFO] Executing tasks
    [echo] childTest3
[INFO] Executed tasks
[INFO] -------------------------------------------------------------------------
---
[INFO] BUILD SUCCESSFUL
[INFO] -------------------------------------------------------------------------
---


<project 
  xmlns="http://maven.apache.org/POM/4.0.0"; 
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd";>
  <modelVersion>4.0.0</modelVersion>
  <groupId>test</groupId>
  <name>parent</name>
  <artifactId>parent</artifactId>
  <packaging>pom</packaging>
  <version>1.0-SNAPSHOT</version>

  <build>
    <defaultGoal>compile</defaultGoal>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>

          <execution>
            <id>test1</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
              <tasks>
                <echo message="test1"/>
              </tasks>
            </configuration>
          </execution>

          <execution>
            <id>test2</id>
            <phase>clean</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
              <tasks>
                <echo message="test2"/>
              </tasks>
            </configuration>
          </execution>

          <execution>
            <id>test3</id>
            <phase>test-compile</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
              <tasks>
                <echo message="test3"/>
              </tasks>
            </configuration>
          </execution>

        </executions>
      </plugin>

    </plugins>
  </build>

</project>
<project 
  xmlns="http://maven.apache.org/POM/4.0.0"; 
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd";>
  <modelVersion>4.0.0</modelVersion>
  <parent>
      <groupId>test</groupId>
      <artifactId>parent</artifactId>
      <version>1.0-SNAPSHOT</version>
      <relativePath>..</relativePath>
  </parent>

  <groupId>test</groupId>
  <name>child</name>
  <artifactId>child</artifactId>
  <packaging>pom</packaging>
  <version>1.0-SNAPSHOT</version>

  <build>
    <defaultGoal>compile</defaultGoal>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>

          <execution>
            <id>childTest1</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
              <tasks>
                <echo message="childTest1"/>
              </tasks>
            </configuration>
          </execution>

          <execution>
            <id>childTest2</id>
            <phase>clean</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
              <tasks>
                <echo message="childTest2"/>
              </tasks>
            </configuration>
          </execution>

          <execution>
            <id>childTest3</id>
            <phase>test-compile</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
              <tasks>
                <echo message="childTest3"/>
              </tasks>
            </configuration>
          </execution>

        </executions>
      </plugin>

    </plugins>
  </build>

</project>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to