4

我的 pom.xml 文件有问题,因为我使用 jdk/jre 1.7(classloader)(最新版本),所以我不太了解问题是什么,它是关于使用 CXF/Spring 的 Web 服务项目:

我的机器:

视窗 7,x64;日食 Juno、Jdk/jre 1.7、Maven 3.0.5、日食编译器 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>

我很感激任何建议。

非常感谢

4

1 回答 1

4

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

于 2013-06-03T18:31:26.740 回答