Maven Release Plugin with JAXB issues

Posted by Wysawyg on Stack Overflow See other posts from Stack Overflow or by Wysawyg
Published on 2010-06-18T15:08:54Z Indexed on 2010/06/18 16:33 UTC
Read the original article Hit count: 349

Filed under:
|
|
|

Hiya,

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

© Stack Overflow or respective owner

Related posts about java

Related posts about maven