配置CXF codegen插件

时间:2013-05-24 10:46:04

标签: maven cxf pom.xml wsdl2java

我的pom.xml文件有问题,我不太清楚,因为我使用jdk / jre 1.7(classloader)(最新版本),问题是什么,它是关于使用CXF / Spring的webservice项目:

我的机器:

Windows 7,x64; eclipse Juno,Jdk / jre 1.7,Maven 3.0.5,eclipse编译器1.7

我知道所有源代码都不是很好:hunf:

错误日志:

Execution generate-sources of goal org.apache.cxf:cxf-codegen-plugin:2.7.3:wsdl2java failed: Unable to load the mojo 'wsdl2java' in the plugin 'org.apache.cxf:cxf-codegen-plugin:2.7.3' due to an API incompatibility: org.codehaus.plexus.component.repository.exception.ComponentLookupException: Bad version number in .class file
-----------------------------------------------------
realm =    plugin>org.apache.cxf:cxf-codegen-plugin:2.7.3
strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
urls[0] = file:/D:/cursos/J2EE/MAVEN/local-repo/org/apache/cxf/cxf-codegen-plugin/2.7.3/cxf-codegen-plugin-2.7.3.jar
urls[1] = file:/D:/cursos/J2EE/MAVEN/local-repo/org/apache/maven/shared/maven-artifact-resolver/1.0/maven-artifact-resolver-1.0.jar
urls[2] = file:/D:/cursos/J2EE/MAVEN/local-repo/org/codehaus/plexus/plexus-utils/2.0.5/plexus-utils-2.0.5.jar
urls[3] = file:/D:/cursos/J2EE/MAVEN/local-repo/org/codehaus/plexus/plexus-archiver/1.2/plexus-archiver-1.2.jar
urls[4] = file:/D:/cursos/J2EE/MAVEN/local-repo/org/codehaus/plexus/plexus-io/1.0.1/plexus-io-1.0.1.jar
urls[5] = file:/D:/cursos/J2EE/MAVEN/local-repo/org/apache/cxf/cxf-api/2.7.3/cxf-api-2.7.3.jar
urls[6] = file:/D:/cursos/J2EE/MAVEN/local-repo/org/codehaus/woodstox/woodstox-core-asl/4.1.4/woodstox-core-asl-4.1.4.jar
urls[7] = file:/D:/cursos/J2EE/MAVEN/local-repo/org/codehaus/woodstox/stax2-api/3.1.1/stax2-api-3.1.1.jar
urls[8] = file:/D:/cursos/J2EE/MAVEN/local-repo/org/apache/ws/xmlschema/xmlschema-core/2.0.3/xmlschema-core-2.0.3.jar
urls[9] = file:/D:/cursos/J2EE/MAVEN/local-repo/org/apache/geronimo/specs/geronimo-javamail_1.4_spec/1.7.1/geronimo-javamail_1.4_spec-1.7.1.jar
urls[10] = file:/D:/cursos/J2EE/MAVEN/local-repo/wsdl4j/wsdl4j/1.6.2/wsdl4j-1.6.2.jar
urls[11] = file:/D:/cursos/J2EE/MAVEN/local-repo/org/apache/cxf/cxf-tools-common/2.7.3/cxf-tools-common-2.7.3.jar
urls[12] = file:/D:/cursos/J2EE/MAVEN/local-repo/org/apache/velocity/velocity/1.7/velocity-1.7.jar
urls[13] = file:/D:/cursos/J2EE/MAVEN/local-repo/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar
urls[14] = file:/D:/cursos/J2EE/MAVEN/local-repo/commons-lang/commons-lang/2.6/commons-lang-2.6.jar
urls[15] = file:/D:/cursos/J2EE/MAVEN/local-repo/com/sun/xml/bind/jaxb-xjc/2.1.13/jaxb-xjc-2.1.13.jar
urls[16] = file:/D:/cursos/J2EE/MAVEN/local-repo/com/sun/xml/bind/jaxb-impl/2.1.13/jaxb-impl-2.1.13.jar
urls[17] = file:/D:/cursos/J2EE/MAVEN/local-repo/org/apache/cxf/cxf-rt-core/2.7.3/cxf-rt-core-2.7.3.jar
urls[18] = file:/D:/cursos/J2EE/MAVEN/local-repo/org/apache/cxf/cxf-tools-wsdlto-core/2.7.3/cxf-tools-wsdlto-core-2.7.3.jar
urls[19] = file:/D:/cursos/J2EE/MAVEN/local-repo/org/apache/cxf/cxf-tools-validator/2.7.3/cxf-tools-validator-2.7.3.jar
urls[20] = file:/D:/cursos/J2EE/MAVEN/local-repo/org/apache/cxf/cxf-rt-bindings-soap/2.7.3/cxf-rt-bindings-soap-2.7.3.jar
urls[21] = file:/D:/cursos/J2EE/MAVEN/local-repo/org/apache/cxf/cxf-rt-databinding-jaxb/2.7.3/cxf-rt-databinding-jaxb-2.7.3.jar
urls[22] = file:/D:/cursos/J2EE/MAVEN/local-repo/org/apache/geronimo/specs/geronimo-activation_1.1_spec/1.1/geronimo-activation_1.1_spec-1.1.jar
urls[23] = file:/D:/cursos/J2EE/MAVEN/local-repo/org/apache/cxf/cxf-tools-wsdlto-databinding-jaxb/2.7.3/cxf-tools-wsdlto-databinding-jaxb-2.7.3.jar
urls[24] = file:/D:/cursos/J2EE/MAVEN/local-repo/org/apache/cxf/cxf-tools-wsdlto-frontend-jaxws/2.7.3/cxf-tools-wsdlto-frontend-jaxws-2.7.3.jar
urls[25] = file:/D:/cursos/J2EE/MAVEN/local-repo/xml-resolver/xml-resolver/1.2/xml-resolver-1.2.jar
urls[26] = file:/D:/cursos/J2EE/MAVEN/local-repo/org/apache/cxf/cxf-tools-wsdlto-frontend-javascript/2.7.3/cxf-tools-wsdlto-frontend-javascript-2.7.3.jar
urls[27] = file:/D:/cursos/J2EE/MAVEN/local-repo/org/apache/cxf/cxf-rt-javascript/2.7.3/cxf-rt-javascript-2.7.3.jar
urls[28] = file:/D:/cursos/J2EE/MAVEN/local-repo/org/springframework/spring-core/3.0.7.RELEASE/spring-core-3.0.7.RELEASE.jar
urls[29] = file:/D:/cursos/J2EE/MAVEN/local-repo/org/springframework/spring-asm/3.0.7.RELEASE/spring-asm-3.0.7.RELEASE.jar
urls[30] = file:/D:/cursos/J2EE/MAVEN/local-repo/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar
urls[31] = file:/D:/cursos/J2EE/MAVEN/local-repo/org/springframework/spring-beans/3.0.7.RELEASE/spring-beans-3.0.7.RELEASE.jar
urls[32] = file:/D:/cursos/J2EE/MAVEN/local-repo/org/springframework/spring-context/3.0.7.RELEASE/spring-context-3.0.7.RELEASE.jar
urls[33] = file:/D:/cursos/J2EE/MAVEN/local-repo/org/springframework/spring-aop/3.0.7.RELEASE/spring-aop-3.0.7.RELEASE.jar
urls[34] = file:/D:/cursos/J2EE/MAVEN/local-repo/aopalliance/aopalliance/1.0/aopalliance-1.0.jar
urls[35] = file:/D:/cursos/J2EE/MAVEN/local-repo/org/springframework/spring-expression/3.0.7.RELEASE/spring-expression-3.0.7.RELEASE.jar
urls[36] = file:/D:/cursos/J2EE/MAVEN/local-repo/org/apache/ant/ant/1.8.4/ant-1.8.4.jar
urls[37] = file:/D:/cursos/J2EE/MAVEN/local-repo/org/apache/ant/ant-launcher/1.8.4/ant-launcher-1.8.4.jar
urls[38] = file:/D:/cursos/J2EE/MAVEN/local-repo/org/apache/ant/ant-nodeps/1.8.1/ant-nodeps-1.8.1.jar
Number of foreign imports: 4
import: Entry[import org.sonatype.plexus.build.incremental from realm ClassRealm[plexus.core, parent: null]]
import: Entry[import org.codehaus.plexus.util.Scanner from realm ClassRealm[plexus.core, parent: null]]
import: Entry[import org.codehaus.plexus.util.AbstractScanner from realm ClassRealm[plexus.core, parent: null]]
import: Entry[import  from realm ClassRealm[maven.api, parent: null]]

-----------------------------------------------------
 (org.apache.cxf:cxf-codegen-plugin:2.7.3:wsdl2java:generate-sources:generate-sources)

和pom.xml内容:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">  
  <modelVersion>4.0.0</modelVersion>  

  <groupId>fr.atatorus</groupId>  
  <artifactId>bookclient</artifactId>  
  <version>1.0-SNAPSHOT</version>  
  <packaging>jar</packaging>  

  <name>bookclient</name>  
  <url>http://maven.apache.org</url>  

  <properties>  
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>  
    <cxf.version>2.7.3</cxf.version>  
    <spring.version>3.1.3.RELEASE</spring.version>      
  </properties>  

  <dependencies>  
        <dependency>  
            <groupId>org.springframework</groupId>  
            <artifactId>spring-core</artifactId>  
            <version>${spring.version}</version>  
        </dependency>  
        <dependency>  
            <groupId>org.springframework</groupId>  
            <artifactId>spring-context</artifactId>  
            <version>${spring.version}</version>  
        </dependency>  
        <dependency>  
            <groupId>org.apache.cxf</groupId>  
            <artifactId>cxf-rt-frontend-jaxws</artifactId>  
            <version>2.7.3</version>  
        </dependency>  

        <dependency>  
            <groupId>junit</groupId>  
            <artifactId>junit</artifactId>  
            <version>3.8.1</version>  
            <scope>test</scope>  
        </dependency>  
  </dependencies>  
  <build>  
        <plugins>  
            <plugin>  
                <groupId>org.apache.maven.plugins</groupId>  
                <artifactId>maven-compiler-plugin</artifactId>  
                <version>2.5</version>  
                <configuration>  
                    <source>1.7</source>  
                    <target>1.7</target>  
                </configuration>  
            </plugin>  

            <plugin>  
                <groupId>org.apache.cxf</groupId>  
                <artifactId>cxf-codegen-plugin</artifactId>  
                <version>${cxf.version}</version>  
                <executions>  
                    <execution>  
                        <id>generate-sources</id>  
                        <phase>generate-sources</phase>  
                        <configuration>  
                            <wsdlRoot>${basedir}/target/resources/wsdl</wsdlRoot>  
                            <wsdlOptions>  
                                <wsdlOption>  
                                    <wsdl>${basedir}/target/resources/wsdl/BookService.wsdl</wsdl>  
                                    <extraargs>  
                                        <extraarg>-client</extraarg>  
                                        <!--  
                                        <extraarg>-impl</extraarg>  
                                            <extraarg>-server</extraarg>  
                                        -->  
                                    </extraargs>  
                                </wsdlOption>  
                            </wsdlOptions>  
                        </configuration>  
                        <goals>  
                            <goal>wsdl2java</goal>  
                        </goals>  
                    </execution>  
                </executions>  
            </plugin>  

            <plugin>  
                <groupId>com.googlecode.maven-download-plugin</groupId>  
                <artifactId>maven-download-plugin</artifactId>  
                <version>1.0.0</version>  
                <executions>  
                    <execution>  
                        <id>Download wsdl</id>  
                        <goals>  
                            <goal>wget</goal>  
                        </goals>  
                        <phase>validate</phase>  
                        <configuration>  
                            <url>http://localhost:8080/bookservice2/services/book?wsdl</url>  
                            <!--  
                            <url>http://localhost:8080/BookService/services?wsdl</url> 
                             -->  
                            <outputDirectory>${basedir}/target/resources/wsdl</outputDirectory>  
                            <outputFileName>BookService.wsdl</outputFileName>  
                            <skipCache>true</skipCache>  
                        </configuration>  
                    </execution>  
                </executions>  
            </plugin>  
            <plugin>  
                <groupId>org.codehaus.mojo</groupId>  
                <artifactId>aspectj-maven-plugin</artifactId>  
                <version>1.3.1</version>  
                <configuration>  
                    <complianceLevel>1.5</complianceLevel>  
                    <aspectLibraries>  
                        <aspectLibrary>  
                            <groupId>org.springframework</groupId>  
                            <artifactId>spring-aspects</artifactId>  
                        </aspectLibrary>  
                    </aspectLibraries>  
                </configuration>  
                <executions>  
                    <execution>  
                        <goals>  
                            <goal>compile</goal>  
                        </goals>  
                    </execution>  
                </executions>  
            </plugin>              
        </plugins>      
  </build>  
</project>

我感谢任何建议。

非常感谢

1 个答案:

答案 0 :(得分:2)

在删除并再次构建项目之后,由于一些xml绑定导入的错误,我发现我的JRE系统库指向J2SE 1.5,在将构建路径更改为jdk 7后,mvn目标就像一个魅力: )