我正在尝试生成webservices客户端,一旦我动态构建我的项目..它目前这样做,但把它放在基于WS的命名空间命名的包中..所以我们假设名称空间是google.com ,生成的文件将在com.google ..
中<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>2.2.10</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<sourceRoot>${basedir}/src/main/java/</sourceRoot>
<wsdlOptions>
<wsdlOption>
<wsdl>http://localhost:8080/ProjectName/ProjectWS?wsdl</wsdl>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>
我想将文件生成到另一个包中。让我们称之为comWS.gooleClient
有可能吗?
由于
答案 0 :(得分:8)
可以使用自定义绑定或传递-p
额外参数,如下所示:
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>2.2.10</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<sourceRoot>${basedir}/src/main/java/</sourceRoot>
<wsdlOptions>
<wsdlOption>
<wsdl>http://localhost:8080/ProjectName/ProjectWS?wsdl</wsdl>
<extraargs>
<extraarg>-p</extraarg>
<extraarg>com.something.else</extraarg>
</extraargs>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>
答案 1 :(得分:6)
我很晚,但这个规范对我有用
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>2.7.7</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<sourceRoot>${basedir}/src/main/java</sourceRoot>
<wsdlOptions>
<wsdlOption>
<wsdl>wsdl-location</wsdl>
<extraargs>
<extraarg>-client</extraarg>
</extraargs>
<packagenames>
<packagename>desired location</packagename>
</packagenames>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>
答案 2 :(得分:1)
你有没有尝试过exarg?
<extraarg><!--namespace-->=<!-- new package name--></extraarg>
示例:
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>2.2.10</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<sourceRoot>${basedir}/src/main/java/</sourceRoot>
<wsdlOptions>
<wsdlOption>
<wsdl>http://localhost:8080/ProjectName/ProjectWS?wsdl</wsdl>
<extraargs>
<extraarg>-p</extraarg>
<extraarg>http://google.com=comWS.gooleClient</extraarg>
</extraargs>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>