多项目Maven编译问题

时间:2014-06-30 08:59:10

标签: maven

我在尝试使用多模块项目构建maven项目时遇到了麻烦。

在主要的pom中我有以下模块:

<modules>
    <module>moduleA</module>
    <module>moduleB</module>
    <module>moduleC</module>
</modules>

当构建第三个模块(包括另外两个)时,我想生成一个带有java2ws目标的wsdl,我得到一个ClassNotFoundException错误(下面的跟踪) 我想这是因为类包含在moduleA的包中。如何在java2ws命令中指定该类包含在另一个模块中?

...

<execution>     
    <id>process-classes-reclamacion</id>
    <phase>process-classes</phase>
    <configuration>
        <className>com.classX</className>
        <genWsdl>true</genWsdl>
        <verbose>true</verbose>
    </configuration>
    <goals>
            <goal>java2ws</goal>
    </goals>
</execution>

...

GRAVE: Failed to execute goal org.apache.cxf:cxf-java2ws-plugin:2.2.6:java2ws on project moduleC: Fail to load class : com.classX -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.cxf:cxf-java2ws-plugin:2.2.6:java2ws on project moduleC : Fail to load class : com.classX
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.jvnet.hudson.maven3.launcher.Maven3Launcher.main(Maven3Launcher.java:117)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:329)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:239)
    at org.jvnet.hudson.maven3.agent.Maven3Main.launch(Maven3Main.java:178)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at hudson.maven.Maven3Builder.call(Maven3Builder.java:134)
    at hudson.maven.Maven3Builder.call(Maven3Builder.java:69)
    at hudson.remoting.UserRequest.perform(UserRequest.java:118)
    at hudson.remoting.UserRequest.perform(UserRequest.java:48)
    at hudson.remoting.Request$2.run(Request.java:328)
    at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
    at java.lang.Thread.run(Thread.java:662)
Caused by: org.apache.maven.plugin.MojoExecutionException: Fail to load class : com.calculo.gestconv.webservices.reclamacion.sdm.IReclamacionSDMWS
    at org.apache.cxf.maven_plugin.Java2WSMojo.processJavaClass(Java2WSMojo.java:268)
    at org.apache.cxf.maven_plugin.Java2WSMojo.execute(Java2WSMojo.java:154)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    ... 31 more
Caused by: org.apache.cxf.tools.common.ToolException: Fail to load class : com.classX
    at org.apache.cxf.tools.util.AnnotationUtil.loadClass(AnnotationUtil.java:83)
    at org.apache.cxf.tools.java2wsdl.processor.JavaToWSDLProcessor.getServiceClass(JavaToWSDLProcessor.java:307)
    at org.apache.cxf.tools.java2wsdl.processor.JavaToWSDLProcessor.getServiceBuilder(JavaToWSDLProcessor.java:204)
    at org.apache.cxf.tools.java2wsdl.processor.JavaToWSDLProcessor.process(JavaToWSDLProcessor.java:127)
    at org.apache.cxf.tools.java2ws.JavaToWSContainer.processWSDL(JavaToWSContainer.java:109)
    at org.apache.cxf.tools.java2ws.JavaToWSContainer.execute(JavaToWSContainer.java:75)
    at org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:103)
    at org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:58)
    at org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:40)
    at org.apache.cxf.tools.java2ws.JavaToWS.run(JavaToWS.java:77)
    at org.apache.cxf.maven_plugin.Java2WSMojo.processJavaClass(Java2WSMojo.java:265)
    ... 34 more
Caused by: java.lang.ClassNotFoundException: com.classX
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    at org.apache.cxf.tools.util.AnnotationUtil.loadClass(AnnotationUtil.java:80)
    ... 44 more

感谢您的帮助。

0 个答案:

没有答案