我正在使用mojohaus jaxb2-maven-plugin从xsd模式文件中生成Java源。我的pom.xml看起来像这样:
...
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<version>2.5.0</version>
<executions>
<execution>
<id>xjc-1</id>
<goals>
<goal>xjc</goal>
</goals>
<configuration>
<packageName>my.first.package.types</packageName>
<sources>
<source>src/main/java/META-INF/wsdl/firstSchema.xsd</source>
</sources>
</configuration>
</execution>
<execution>
<id>xjc-2</id>
<goals>
<goal>xjc</goal>
</goals>
<configuration>
<packageName>my.second.package.types</packageName>
<sources>
<source>src/main/java/META-INF/wsdl/secondSchema.xsd</source>
</sources>
<clearOutputDir>false</clearOutputDir>
</configuration>
</execution>
</executions>
<configuration>
<outputDirectory>src/main/javagen</outputDirectory>
</configuration>
</plugin>
此插件配置应对应于here。当我运行构建时,从第一个架构生成的源文件被放入第二个包中。谁能向我解释为什么会这样?那是一个错误还是我错过了什么?非常感谢您的输入!
编辑:
我也尝试过maven-jaxb2-plugin。结果一样!因此,这似乎是一个普遍的问题。我的maven-jaxb2-plugin插件配置如下:
...
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.14.0</version>
<executions>
<execution>
<id>first</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<schemaIncludes>
<include>firstSchema.xsd</include>
</schemaIncludes>
<generatePackage>my.first.package.types</generatePackage>
</configuration>
</execution>
<execution>
<id>second</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<schemaIncludes>
<include>secondSchema.xsd</include>
</schemaIncludes>
<generatePackage>my.second.package.types</generatePackage>
</configuration>
</execution>
</executions>
<configuration>
<schemaDirectory>src/main/java/META-INF/wsdl</schemaDirectory>
<generateDirectory>src/main/javagen</generateDirectory>
</configuration>
</plugin>
有人有什么想法吗?这开始让我有些烦恼...
我正在使用mojohaus jaxb2-maven-plugin从xsd模式文件中生成Java源。我的pom.xml看起来像这样:...