We’ve got a project set up to use the Maven Release Plugin which includes a phase that unpacks a JAR of XML schemas pulled from Artifactory and a phase that generates XJC classes. We’re on maven release 2.2.1.
Unfortunately the latter phase is executing before the former which means that it isn’t generating the XJC classes for the schema. A partial POM.XML looks like:
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack</id>
<!-- phase>generate-sources</phase -->
<goals>
<goal>unpack</goal>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>ourgroupid</groupId>
<artifactId>ourschemas</artifactId>
<version>5.1</version>
<outputDirectory>${project.basedir}/src/main/webapp/xsd</outputDirectory>
<excludes>META-INF/</excludes>
<overWrite>true</overWrite>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>maven-buildnumber-plugin</artifactId>
<version>0.9.6</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>create</goal>
</goals>
</execution>
</executions>
<configuration>
<doCheck>true</doCheck>
<doUpdate>true</doUpdate>
</configuration>
</plugin>
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<configuration>
<schemaDirectory>${project.basedir}/src/main/webapp/xsd</schemaDirectory>
<schemaIncludes>
<include>*.xsd</include>
<include>*/*.xsd</include>
</schemaIncludes>
<verbose>true</verbose>
<!-- args>
<arg>-Djavax.xml.validation.SchemaFactory:http://www.w3.org/2001/XMLSchema=org.apache.xerces.jaxp.validation.XMLSchemaFactory</arg>
</args-->
</configuration>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
I’ve tried googling for it, unfortunately I ended up with a case of thousands of links none of which were actually relevant so I’d be very grateful if someone knew how to configure the order of the release plugin steps to ensure a was fully executed before it did b.
Thanks
There has been some issues with ordering of execution (e.g. MNG-3719, MNG-2258) but it should be fine with Maven 2.2.1 and plugins should be executed in the same order as they are listed in the POM when bound to the same phase. And indeed, with your POM slightly modified:
<phase>generate-sources</phase>of the dependency pluginidto theexecutionelementsI get the following output:
$ mvn generate-sources [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] Building Q3070794 [INFO] task-segment: [generate-sources] [INFO] ------------------------------------------------------------------------ [INFO] [dependency:unpack {execution: step1-unpack}] [INFO] Configured Artifact: c3p0:c3p0:0.9.1.2:jar [INFO] Unpacking /home/pascal/.m2/repository/c3p0/c3p0/0.9.1.2/c3p0-0.9.1.2.jarto /home/pascal/Projects/stackoverflow/Q3070794/src/main/webapp/xsd with Includes null and excludes:META-INF/ [INFO] [dependency:copy {execution: step1-unpack}] [INFO] Configured Artifact: c3p0:c3p0:0.9.1.2:jar [INFO] Copying c3p0-0.9.1.2.jar to /home/pascal/Projects/stackoverflow/Q3070794/src/main/webapp/xsd/c3p0-0.9.1.2.jar [INFO] [jaxb2:generate {execution: step2-xjc}] [INFO] Started execution. ...The
dependency:unpackanddependency:copyis done BEFOREjaxb2:generate. Unless I’m missing something, this is the expected result. Tested with Maven 2.2.1.