Question

I am trying to migrate a Java application built by Ant to Maven2. Among other the build perform the following operations:

  1. Running a javadoc doclet to find annotated Java files to be externalize later as Web services

  2. compile a small part of the code for step 3

  3. run Axis java2wsdl on the compiled code from step 2

  4. produce Java code with wsdl2java on the WSDL files from step 3

  5. compile the entire code

When trying to "mavenize" the process I can accomplish each task at a time but fail to achieve them all in that order.

To demonstrate my pom and not load you with details I'll show the following snippet:

<build>
<plugins>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>2.6.1</version>
        <executions>
            <execution>
                <id>aggregate</id>
                <phase>generate-sources</phase>
                <goals>
                    <goal>aggregate</goal>
                </goals>
                <configuration>...</configuration>
            </execution>
        </executions>
    </plugin>
        <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>2.1</version>
        <executions>
            <execution>
                <id>compileWSfiles</id>
                <goals>
                    <goal>compile</goal>
               </goals>
               <phase>generate-sources</phase>
                <configuration>
                    <includes>
                        <!-- include 3 source files -->
                    </includes>
                </configuration>

            </execution>
        </executions>
      </plugin>
          <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>axistools-maven-plugin</artifactId>
        <version>1.3</version>
        <dependencies>
          <dependency>
                <groupId>axis</groupId>
                <artifactId>axis</artifactId>
                <version>1.3</version>
          </dependency>
        </dependencies>
        <executions>
            <execution>
                <id>java2wsdl</id>
                <phase>generate-sources</phase>
                <goals>
                    <goal>java2wsdl</goal>
                </goals>
                <configuration>...</configuration>
            </execution>

             <execution>
                <id>wsdl2java</id>
                <phase>generate-sources</phase>
                                    <goals>
                                           <goal>wsdl2java</goal>
                                    </goals>
                                    <configuration>...</configuration>
                            </execution> 
        </executions>
    </plugin>
</plugins>

The main problem is that I have no control on the order of things and it is obviously important here as every step output is the next step input.

Was it helpful?

Solution

Plugins bound to the same phase should be executed in the same order as they are listed in the POM but... there is an open issue about this (MNG-2258). Also have a look at a the related issue MNG-3719 (pay a special attention to this comment). Since I don't think that the "cheat" of MNG-3719 is possible in your case, my suggestion is to try with Maven 2.0.8 :( And cross your fingers to not face any regression.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top