Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
649 views
in Technique[技术] by (71.8m points)

maven compilation failure

I have a weird problem - Some class file couldn't be read during maven build.

  1. I have a project A and project B.
  2. Project B depends on the project A target JAR file.

During the project B compilation it is not able to read lib in the project A JAR file - though the part directed to it is perfect.

I have also checked and verified the maven script and it is perfect.

Error:

[INFO] Compiling 137 source files to V:dhs_tss_build_viewdhs_tssprojectsssscommon-serverargetclasses
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Compilation failure

V:/dhs_tss_build_view/dhs_tssproject/tss/tsscommon-server/src/main/java/us/mn/state/dhs/tss/common/oblix/da/wsdl/OblixLoginAc
cess.java:[51,60] cannot find symbol
symbol  : class BusinessException
location: class us.mn.state.dhs.tss.common.oblix.da.wsdl.OblixLoginAccess

V:/dhs_tss_build_view/dhs_tssproject/tss/tsscommon-server/src/main/java/us/mn/state/dhs/tss/common/app/da/ldap/BaseLdapImpl.j
ava:[187,14] cannot find symbol
symbol  : class Phone
location: class us.mn.state.dhs.tss.common.app.da.ldap.BaseLdapImpl

V:/dhs_tss_build_view/dhs_tssproject/tss/tsscommon-server/src/main/java/us/mn/state/dhs/tss/common/app/da/ldap/BaseLdapImpl.j
ava:[204,14] cannot find symbol
symbol  : class Phone
location: class us.mn.state.dhs.tss.common.app.da.ldap.BaseLdapImpl


[INFO] ------------------------------------------------------------------------
[DEBUG] Trace
org.apache.maven.BuildFailureException: Compilation failure
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:579)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:499)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:478)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:330
)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:291)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:142)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:287)
        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:585)
        at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.CompilationFailureException: Compilation failure
        at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:516)
        at org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:114)
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:451)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:558)
        ... 16 more
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 minute 56 seconds
[INFO] Finished at: Mon Oct 19 09:46:53 CDT 2009
[INFO] Final Memory: 11M/20M
[INFO] ------------------------------------------------------------------------
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I had the same problem and this is how I suggest you fix it:

Run:

mvn dependency:list

and read carefully if there are any warning messages indicating that for some dependencies there will be no transitive dependencies available.

If yes, re-run it with -X flag:

mvn dependency:list -X

to see detailed info what is maven complaining about (there might be a lot of output for -X flag)

In my case there was a problem in dependent maven module pom.xml - with managed dependency. Although there was a version for the managed dependency defined in parent pom, Maven was unable to resolve it and was complaining about missing version in the dependent pom.xml

So I just configured the missing version and the problem disappeared.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...