【发布时间】:2011-03-05 11:44:17
【问题描述】:
我们已经建立了一个使用 Maven 发布插件的项目,其中包括一个阶段,该阶段解压从 Artifactory 中提取的 XML 模式的 JAR 和一个生成 XJC 类的阶段。我们正在使用 Maven 版本 2.2.1。
不幸的是,后一个阶段在前一个阶段之前执行,这意味着它没有为模式生成 XJC 类。部分 POM.XML 如下所示:
<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>
我试过用谷歌搜索它,不幸的是,我最终得到了一个包含数千个链接的案例,其中没有一个实际上是相关的,所以如果有人知道如何配置发布插件步骤的顺序以确保a 在执行 b 之前已完全执行。
谢谢
【问题讨论】:
-
您使用的是哪个 maven 版本?因为2.2.0之前的生命周期执行顺序有bug,我认为
-
2.2.1 不幸的是,至少不幸的是,否则升级将是一个简单的解决方案。
标签: java maven-2 jaxb xjc maven-release-plugin