Java CXF忽略sourceRoot配置参数
我正在使用CXF maven插件从wsdl生成Java类Java CXF忽略sourceRoot配置参数,java,wsdl,cxf,maven-plugin,Java,Wsdl,Cxf,Maven Plugin,我正在使用CXF maven插件从wsdl生成Java类 org.apache.cxf cxf-codegen插件 ${cxf codegen plugin.version} wsdl2java src/main/generated src/main/resources/wsdl/contentprovidercallback.wsdl -冗长的 -前端 jaxws21 -b src/main/resources/wsdl/jaxws-contentprovidercallback.xml -
org.apache.cxf
cxf-codegen插件
${cxf codegen plugin.version}
wsdl2java
src/main/generated
src/main/resources/wsdl/contentprovidercallback.wsdl
-冗长的
-前端
jaxws21
-b
src/main/resources/wsdl/jaxws-contentprovidercallback.xml
-d
src/main/generated
-FaultSerialVersionId
FQCN
-xjc Xts
-xjc XhashCode
-xjc Xequals
wsdl2java
org.codehaus.woodstox
stax2 api
${stax2.api.version}
org.apache.cxf.xjc插件
cxf xjc ts
${cxf.xjc.ts.version}
org.jvnet.jaxb2_commons
jaxb2基础知识
${jaxb2.basics.version}
当我试图执行cxf codegen:wsdl2java
goal时,生成的类不会在定义的sourceRoot目录中生成
当我使用调试选项(-X-e)运行mvn
时,我得到:
...
[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清洁安装期间,
源代码生成良好(在生成的文件夹中)。但我不想在每次构建时生成这些类
你知道怎么回事吗?这个问题很老了,但我也有同样的问题,我想把解决方案留到将来: 不知何故,
cxfcodegenplugin
需要执行一些maven阶段,以便能够“抓取”配置元素,而不是使用默认值。我所做的是从默认构建中删除插件并创建一个概要文件,以便能够将其作为应用程序的一部分运行
按需生成源
阶段,而不是每次构建
我的看起来像这样:
<profile>
<id>generate-ws-stub</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<version.cxf>2.3.0</version.cxf>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>${version.cxf}</version>
<dependencies>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>${version.cxf}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-ws-security</artifactId>
<version>${version.cxf}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-core</artifactId>
<version>${version.cxf}</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<sourceRoot>${project.build.sourceDirectory}\prb</sourceRoot>
<wsdlOptions>
<wsdlOption>
<wsdl>${project.build.resources[0].directory}/wsdl/NoneOfYourBusinessWS.wsdl</wsdl>
<wsdlLocation>classpath:wsdl/NoneOfYourBusinessWS.wsdl</wsdlLocation>
<extraargs>
<extraarg>-verbose</extraarg>
<extraarg>-impl</extraarg>
</extraargs>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
生成ws-stub
假的
2.3.0
UTF-8
org.apache.cxf
cxf-codegen插件
${version.cxf}
org.apache.cxf
cxf rt传输http
${version.cxf}
org.apache.cxf
cxf rt ws-security
${version.cxf}
org.apache.cxf
cxf rt核
${version.cxf}
生成源
生成源
${project.build.sourceDirectory}\prb
${project.build.resources[0]。目录}/wsdl/NoneOfYourBusinessWS.wsdl
类路径:wsdl/NoneOfYourBusinessWS.wsdl
-冗长的
-恳求
wsdl2java
现在,每当我想“刷新”我的XML绑定时,我只需运行mvn generate sources-p generate ws stub