Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

maven compilation failure

Tags:

maven-2

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_view\dhs_tssproject\tss\tsscommon-server\target\classes [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] ------------------------------------------------------------------------ 
like image 470
dagg Avatar asked Oct 19 '09 14:10

dagg


People also ask

What is compilation in Maven?

The compiler plugin is used to compile the source code of a Maven project. This plugin has two goals, which are already bound to specific phases of the default lifecycle: compile – compile main source files. testCompile – compile test source files.

Why does Maven build failure in eclipse?

The error message indicates that Maven is unable to find the Java compiler, which comes only with a JDK and not with a JRE.


1 Answers

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.

like image 147
Michal Moravcik Avatar answered Oct 01 '22 18:10

Michal Moravcik