My codes has these compile errors:

[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile
(default-compile) on project proj2-war: Compilation failure: Compilation
failure:
[ERROR]
/C:/proj2/proj2-parent/proj2-war/src/main/java/com/mypack/web/common/MyClass.java:[220,340]
cannot find symbol
[ERROR] symbol: class EJBClientResult
[ERROR] location: package mypack.ejb.myproj2

when running

cd C:\proj2\proj2-parent
mvn clean compile



The missing EJBClientResult class is in the mypack.common-2021.03.jar file.

Another similar project which use the same jar file compile successfully.

cd C:\proj1\proj1-parent
mvn clean compile

so the same jar file is present in my maven local repository and maven is
setup properly.

I had done a "mvn clean install" for both projects.

To debug, run

mvn -X clean compile


proj1-parent output:

[DEBUG] com.mypack:mypack.common:jar:2021.03:compile

[DEBUG] Adding URL
[file:/C:/Users/ak/.m2/repository/com/mypack/mypack.common/2021.03/mypack.common-2021.03.jar]

[DEBUG] (f) classpathElements
C:\Users\ak\.m2\repository\com\mypack\mypack.common\2021.03\mypack.common-2021.03.jar

BUILD SUCCESS


proj2-parent output:

[DEBUG] com.mypack:mypack.common:jar:2021.03:compile

[DEBUG] (f) classpathElements
C:\Users\ak\.m2\repository\com\mypack\mypack.common\2021.03\mypack.common-2021.03.jar


[ERROR]
/C:/proj2/proj2-parent/proj2-war/src/main/java/com/mypack/web/common/MyClass.java:[220,340]
cannot find symbol
[ERROR] symbol: class EJBClientResult
[ERROR] location: package mypack.ejb.myproj2



Both projects have the same dependency in the pom.xml:

    <dependency>
        <groupId>com.mypack</groupId>
        <artifactId>mypack.common</artifactId>
        <version>2021.03</version>
    </dependency>



How to fix this compile error?
Please help.
Thanks.

Reply via email to