tags:

views:

1338

answers:

3

I have a weird problem. Some class file couldn't be read during maven build. I have a project A and project B where 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 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] ------------------------------------------------------------------------
A: 

You could try running the "mvn site" command and see what transitive dependencies you have, and then resolve potential conflicts (by ommitting an implicit dependency somewhere). Just a guess (it's a bit difficult to know what the problem could be without seeing your pom info)...

davek
actually they are no site goals for the parent and the child, i am getting the failure when it starts compiling the project b though the project a is getting successful
dagg
A: 

My guess is a wrong version of project A jar in your local maven repository. It seems that the dependency is resolved otherwise I think maven does not start compiling but usually these compiling error means that you have a version mix up. try to make a maven clean install of your project A and see if it changes something for the project B... Also a little more information on your setting could be useful:

  • How is maven launched? what command? on a shell, an IDE (using a plugin or not), on a CI server?
  • What maven command are you using?
florent
versions are perfect, i am using mvn clean install on command promt.when i did debug using -X i have seennthe dependency directing the right path toward the jar though it is not recogniseing it
dagg
are you sure the jar of project A is correctly generated? can you find the class/method if you look into it manually (or manually add it as a dependency to a new empty project?did you try emptying your local repo?
florent
yes i can see the class \methods in jar
dagg
then i don't know, maybe something is cached...
florent
thanks for your time, i need a confirmation does the class file name and the class mentioned in java file should be same including case sensitive
dagg
is it an inner class? in this case no, in the other case I don't know, i never did it otherwise (usually goood practice and i think it should)
florent
A: 

The error is pretty clear: "cannot find symbol". Some dependencies can't be resolved (you even have the line and column in the trace of the reference that can't be resolved):

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

Below a couple of things to verify:

  • Check or recheck that these classes are in the jar A (same version as in the pom)
  • Check or recheck the import statement in B sources (should match the package of classes in A)
  • Check or recheck B's pom.xml and especially the declaration of the dependency on A (it's version)
  • Check that the dependency on A is not excluded transitively somewhere in B's pom
  • Is A a SNAPSHOT dependency? If no, delete A from your local repository and rebuild

Maven is working fine, you have a mistake somewhere.

Pascal Thivent