我正在使用 CXF maven 插件从 wsdl 生成 Java 类
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>${cxf-codegen-plugin.version}</version>
<executions>
<execution>
<id>wsdl2java</id>
<configuration>
<sourceRoot>src/main/generated</sourceRoot>
<wsdlOptions>
<wsdlOption>
<wsdl>src/main/resources/wsdl/contentprovidercallback.wsdl</wsdl>
<extraargs>
<extraarg>-verbose</extraarg>
<extraarg>-frontend</extraarg>
<extraarg>jaxws21</extraarg>
<extraarg>-b</extraarg>
<extraarg>src/main/resources/wsdl/jaxws-contentprovidercallback.xml</extraarg>
<extraarg>-d</extraarg>
<extraarg>src/main/generated</extraarg>
<extraarg>-faultSerialVersionUID</extraarg>
<extraarg>FQCN</extraarg>
<extraarg>-xjc-Xts</extraarg>
<extraarg>-xjc-XhashCode</extraarg>
<extraarg>-xjc-Xequals</extraarg>
</extraargs>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.codehaus.woodstox</groupId>
<artifactId>stax2-api</artifactId>
<version>${stax2.api.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf.xjcplugins</groupId>
<artifactId>cxf-xjc-ts</artifactId>
<version>${cxf.xjc.ts.version}</version>
</dependency>
<dependency>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics</artifactId>
<version>${jaxb2.basics.version}</version>
</dependency>
</dependencies>
</plugin>
当我尝试执行cxf-codegen:wsdl2java
目标时,生成的类不会在定义的 sourceRoot 目录中生成。
当我mvn
使用调试选项(-X -e)运行时,我得到:
...
[DEBUG] Configuring mojo org.apache.cxf:cxf-codegen-plugin:2.6.1:wsdl2java from plugin realm ClassRealm[plugin>org.apache.cxf:cxf-codegen-plugin:2.6.1, parent: sun.misc.Launcher$AppClassLoader@425224ee]
[DEBUG] Configuring mojo 'org.apache.cxf:cxf-codegen-plugin:2.6.1:wsdl2java' with basic configurator -->
[DEBUG] (f) classesDirectory = C:\WsdlTest\target\classes
[DEBUG] (f) disableDependencyScan = false
[DEBUG] (f) disableDirectoryScan = false
[DEBUG] (f) encoding = UTF-8
[DEBUG] (f) fork = false
[DEBUG] (f) javaExecutable = C:\Program Files\Java\jdk1.6.0_31\jre/bin/java
[DEBUG] (f) localRepository = id: local
url: file:///C:/Users/admi/.m2/repository/
layout: none
[DEBUG] (f) markerDirectory = C:\WsdlTest\target\cxf-codegen-plugin-markers
[DEBUG] (f) mavenSession = org.apache.maven.execution.MavenSession@59cc5d23
[DEBUG] (f) pluginArtifacts = [org.apache.cxf:cxf-codegen-plugin:maven-plugin:2.6.1:, org.codehaus.woodstox:stax2-api:jar:3.0.2:runtime, javax.xml.stream:stax-api:jar:1.0-2:runtime, org.apache.cxf.xjcplugins:cxf-xjc-ts:jar:2.4.0:runtime, commons-lang:commons-lang:jar:2.6:compile, org.jvnet.jaxb2_commons:jaxb2-basics:jar:0.6.3:runtime, org.jvnet.jaxb2_commons:jaxb2-basics-runtime:jar:0.6.3:runtime, org.jvnet.jaxb2_commons:jaxb2-basics-tools:jar:0.6.3:runtime, commons-beanutils:commons-beanutils:jar:1.7.0:runtime, org.apache.maven.shared:maven-artifact-resolver:jar:1.0:compile, org.codehaus.plexus:plexus-utils:jar:2.0.5:compile, org.codehaus.plexus:plexus-archiver:jar:1.2:compile, org.codehaus.plexus:plexus-io:jar:1.0.1:compile, org.apache.cxf:cxf-api:jar:2.6.1:compile, org.codehaus.woodstox:woodstox-core-asl:jar:4.1.2:runtime, org.apache.ws.xmlschema:xmlschema-core:jar:2.0.2:compile, org.apache.geronimo.specs:geronimo-javamail_1.4_spec:jar:1.7.1:compile, wsdl4j:wsdl4j:jar:1.6.2:compile, org.apache.cxf:cxf-tools-common:jar:2.6.1:compile, org.apache.velocity:velocity:jar:1.7:compile, commons-collections:commons-collections:jar:3.2.1:compile, com.sun.xml.bind:jaxb-xjc:jar:2.1.13:compile, com.sun.xml.bind:jaxb-impl:jar:2.1.13:compile, org.apache.cxf:cxf-rt-core:jar:2.6.1:compile, org.apache.cxf:cxf-tools-wsdlto-core:jar:2.6.1:compile, org.apache.cxf:cxf-tools-validator:jar:2.6.1:compile, org.apache.cxf:cxf-rt-bindings-soap:jar:2.6.1:compile, org.apache.cxf:cxf-rt-databinding-jaxb:jar:2.6.1:compile, org.apache.cxf:cxf-tools-wsdlto-databinding-jaxb:jar:2.6.1:compile, org.apache.cxf:cxf-tools-wsdlto-frontend-jaxws:jar:2.6.1:compile, xml-resolver:xml-resolver:jar:1.2:compile, org.apache.cxf:cxf-tools-wsdlto-frontend-javascript:jar:2.6.1:compile, org.apache.cxf:cxf-rt-javascript:jar:2.6.1:compile, org.springframework:spring-core:jar:3.0.7.RELEASE:compile, org.springframework:spring-asm:jar:3.0.7.RELEASE:compile, commons-logging:commons-logging:jar:1.1.1:compile, org.springframework:spring-beans:jar:3.0.7.RELEASE:compile, org.springframework:spring-context:jar:3.0.7.RELEASE:compile, org.springframework:spring-aop:jar:3.0.7.RELEASE:compile, aopalliance:aopalliance:jar:1.0:compile, org.springframework:spring-expression:jar:3.0.7.RELEASE:compile, org.apache.ant:ant:jar:1.8.2:compile, org.apache.ant:ant-launcher:jar:1.8.2:compile, org.apache.ant:ant-nodeps:jar:1.8.1:compile]
[DEBUG] (f) project = MavenProject: com.tmobile.tmo.pfw:ssa:1.0.0-SNAPSHOT @ C:\WsdlTest\pom.xml
[DEBUG] (f) repositories = [id = 'releases', id = 'snapshots', id = 'central']
[DEBUG] (f) sourceRoot = C:\WsdlTest\target\generated-sources\cxf
[DEBUG] (f) testWsdlRoot = C:\WsdlTest\src\test\resources\wsdl
[DEBUG] (f) useCompileClasspath = false
[DEBUG] (f) wsdlRoot = C:\WsdlTest\src\main\resources\wsdl
[DEBUG] -- end configuration --
...
另一方面,在mvn clean install
生成源期间(在生成的文件夹中)。但我不想在每次构建时生成这些类。
知道有什么问题吗?