Java maven-jaxb2-plugin不同包中的多个模式错误
我对Java maven-jaxb2-plugin不同包中的多个模式错误,java,soap,wsdl,xjc,maven-jaxb2-plugin,Java,Soap,Wsdl,Xjc,Maven Jaxb2 Plugin,我对maven-jaxb2-plugin有问题。 我试图实现的是从x个不同的wsdl生成到不同包中的源 我希望避免使用多个的方法,以便在添加另一个wsdl时保持pom.xml不变 我对maven插件的配置如下: <plugin> <groupId>org.jvnet.jaxb2.maven2</groupId> <artifactId>maven-jaxb2-plugin</artifactId> <ver
maven-jaxb2-plugin
有问题。
我试图实现的是从x个不同的wsdl生成到不同包中的源
我希望避免使用多个
的方法,以便在添加另一个wsdl时保持pom.xml不变
我对maven插件的配置如下:
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.12.1</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<schemaLanguage>WSDL</schemaLanguage>
<schemaDirectory>src/main/resources/webservice/wsdl</schemaDirectory>
<schemaIncludes>
<include>orig/*.wsdl</include>
</schemaIncludes>
<bindingDirectory>src/main/resources/webservice/xjb</bindingDirectory>
<bindingIncludes>
<include>orig/*.xjb</include>
</bindingIncludes>
</configuration>
</execution>
</executions>
</plugin>
更重要的是,出于测试目的,我尝试将插件配置为在单独的
中处理每个wsdl(我希望在最终代码中避免这种情况),并且我观察到,在处理了第一个ex.soap1.wsdl之后,正确创建了包,但根本没有创建其他soap.wsdl包。(只处理了第一个)
这有什么不对,如果有可能实现我想要的吗?
更新:
为了阐明我想要实现的目标,我将在那里发布适合我的解决方案,但它迫使我在每次添加新Web服务时编辑POM:
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.12.1</version>
<executions>
<execution>
<id>soap1</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<schemaDirectory>src/main/resources/webservice/wsdl</schemaDirectory>
<schemaIncludes>
<include>Soap1.wsdl</include>
</schemaIncludes>
<generatePackage>my.package.com.soap1</generatePackage>
</configuration>
</execution>
<execution>
<id>soap2</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<schemaDirectory>src/main/resources/webservice/wsdl</schemaDirectory>
<schemaIncludes>
<include>Soap2.wsdl</include>
</schemaIncludes>
<generatePackage>my.package.com.soap2</generatePackage>
</configuration>
</execution>
<execution>
<id>soap3</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<schemaDirectory>src/main/resources/webservice/wsdl</schemaDirectory>
<schemaIncludes>
<include>Soap3.wsdl</include>
</schemaIncludes>
<bindingDirectory>src/main/resources/webservice/xjb</bindingDirectory>
<bindingIncludes>
<include>soap3.xjb</include>
</bindingIncludes>
<generatePackage>my.package.com.soap3</generatePackage>
</configuration>
</execution>
</executions>
</plugin>
org.jvnet.jaxb2.maven2
maven-jaxb2-plugin
0.12.1
soap1
生成
src/main/resources/webservice/wsdl
Soap1.wsdl
my.package.com.soap1
soap2
生成
src/main/resources/webservice/wsdl
Soap2.wsdl
my.package.com.soap2
soap3
生成
src/main/resources/webservice/wsdl
Soap3.wsdl
src/main/resources/webservice/xjb
soap3.xjb
my.package.com.soap3
看起来(可能?)在以下方面存在一些问题:
<jaxb:schemaBindings>
<jaxb:package name="my.package.com.soap1" />
</jaxb:schemaBindings>
在我的第一个(也是我想要的)解决方案中。有什么想法吗
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.12.1</version>
<executions>
<execution>
<id>soap1</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<schemaDirectory>src/main/resources/webservice/wsdl</schemaDirectory>
<schemaIncludes>
<include>Soap1.wsdl</include>
</schemaIncludes>
<generatePackage>my.package.com.soap1</generatePackage>
</configuration>
</execution>
<execution>
<id>soap2</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<schemaDirectory>src/main/resources/webservice/wsdl</schemaDirectory>
<schemaIncludes>
<include>Soap2.wsdl</include>
</schemaIncludes>
<generatePackage>my.package.com.soap2</generatePackage>
</configuration>
</execution>
<execution>
<id>soap3</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<schemaDirectory>src/main/resources/webservice/wsdl</schemaDirectory>
<schemaIncludes>
<include>Soap3.wsdl</include>
</schemaIncludes>
<bindingDirectory>src/main/resources/webservice/xjb</bindingDirectory>
<bindingIncludes>
<include>soap3.xjb</include>
</bindingIncludes>
<generatePackage>my.package.com.soap3</generatePackage>
</configuration>
</execution>
</executions>
</plugin>
<jaxb:schemaBindings>
<jaxb:package name="my.package.com.soap1" />
</jaxb:schemaBindings>