views:

172

answers:

1

Hi,

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.

any suggestions?

Thanks, Ronen.

+1  A: 

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.

Pascal Thivent
Thanks.Do you think writing my own plugin that perform the above operations is a possible solution. can I create a plugin with a goal that runs other plugin goals?
rperez
@rperez I'm not sure (see http://www.mail-archive.com/[email protected]/msg104478.html). I never tried this actually.
Pascal Thivent