You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by albert kao <al...@gmail.com> on 2022/03/05 15:21:08 UTC

maven cannot find symbol class EJBClientResult

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.

Re: maven cannot find symbol class EJBClientResult

Posted by albert kao <al...@gmail.com>.
Yes, this is an old company project.
This is an internal company artifactory.
We are converting from Ant to maven.
The EJBClientResult.java is defined in the mypack.common-2021.03.jar.
One project find this jar so compile with maven successfully.
Another project do not find this jar so compile with an error in maven.
The search for EJBClientResult.java within both structures ( projects):
import com.mypack.EJBClientResult;
//...
ArrayList<EJBClientResult> list = ejbResp.getEJBClientResult();
//...

`mvn clean verify -DskipTests` compile with the same error "cannot find
symbol : class EJBClientResult".

On Sun, Mar 6, 2022 at 11:42 AM John Patrick <nh...@gmail.com> wrote:

> Is this an old company project?
> As maven-compiler-plugin is showing as v3.5.1 and that was released in Feb
> 2016.
> Also the group id com.mypack is not in maven central so probably in an
> internal company nexus or artifactory.
> So you might need to search for someone who previous built it.
>
> If you search for EJBClientResult.java within your structure do you find
> it?
>
> Does `mvn clean verify -DskipTests` work? as it might be it's within a
> module of your parent project.
>
> John
>
>
>
> On Sun, 6 Mar 2022 at 16:06, albert kao <al...@gmail.com> wrote:
>
> > 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.
> >
>

Re: maven cannot find symbol class EJBClientResult

Posted by John Patrick <nh...@gmail.com>.
Is this an old company project?
As maven-compiler-plugin is showing as v3.5.1 and that was released in Feb
2016.
Also the group id com.mypack is not in maven central so probably in an
internal company nexus or artifactory.
So you might need to search for someone who previous built it.

If you search for EJBClientResult.java within your structure do you find it?

Does `mvn clean verify -DskipTests` work? as it might be it's within a
module of your parent project.

John



On Sun, 6 Mar 2022 at 16:06, albert kao <al...@gmail.com> wrote:

> 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.
>