在CXF wsdl2java中设置Java Compliance Level
||
我是CXF的新手,正在尝试通过WSDL创建一个客户端。我过去曾使用Metro和Axis。我下载了apache-cxf-2.3.3,并使用wsdl2java生成了客户端存根。我使用Maven并通过以下方法设置我的pom:
<properties>
<cxf.version>2.3.3</cxf.version>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-ws-security</artifactId>
<version>${cxf.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<inherited>true</inherited>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
<optimize>true</optimize>
<debug>true</debug>
</configuration>
</plugin>
</plugins>
</build>
构建项目时,出现以下错误:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project client-cxf: Compilation failure: Compilation failure:
[ERROR] \\Devel\\Projects\\Client-CXF\\src\\main\\java\\my\\webservice\\ServiceRuntimeException.java:[38,149] cannot find symbol
[ERROR] symbol : method required()
和
[ERROR] \\Devel\\Projects\\Client-CXF\\src\\main\\java\\my\\snmpv2\\MyService.java:[76,8] cannot find symbol
[ERROR] symbol : constructor Service(java.net.URL,javax.xml.namespace.QName,javax.xml.ws.WebServiceFeature[])
[ERROR] location: class javax.xml.ws.Service
看起来问题与以下事实有关:生成的代码使用Java 6功能(XmlElementRef为“ require”元素,Service为新构造函数),而CXF Maven依赖项则为Java 5。
有没有一种方法可以指定生成的代码应符合Java 5?
没有找到相关结果
已邀请:
2 个回复
呕蹿尉
绵扇寸访