我有一个多模块maven项目,我需要从JaxB注释类构建XML模式。这些类在不同的maven项目中。我可以使用jaxb2-maven-plugin通过指向所有项目的源来生成单个模式吗?也许是这样......
<configuration>
...
<includes>
<include>../OtherProj1/src/main/java/**/*.java</include>
<include>../OtherProj2/src/main/java/**/*.java</include>
<include>**/*.java</include>
</includes>
...
</configuration>
或者我是否需要单独为每个项目创建一个模式,然后将它们导入父模式?
我正在使用maven 2.2.1和jaxb2-maven-plugin 1.3。
答案 0 :(得分:0)
我认为antrun插件是包含来自mvn项目外部的源以生成XML模式的唯一方法。
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<phase>generate-resources</phase>
<configuration>
<target>
<taskdef name="schemagen" classname="com.sun.tools.jxc.SchemaGenTask">
</taskdef>
<schemagen destdir="src/main/resources/" includes="<comma separated paths to include>"
excludes="<comma separated paths to exclude>">
<src path="src/main/java" />
<src path="../OtherProj1/src/main/java" />
<src path="../OtherProj2/src/main/java" />
</schemagen>
<move file="src/main/resources/schema1.xsd" tofile="src/main/resources/<filename>.xsd" />
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>