简体   繁体   中英

Jenkins Maven compilation error cannot find symbol

Hello I know this is a basic question but please help me to understand and resolve the issue, as I have no clue what is happening.

I have two projects lets say Project A and project B. Project A dependency is used Project B.

Scenario 1 When I build project A, it is build successfully and related jar file is available in my local repo and project B is build successfully with the dependent jar file.

Scenario 2 When I directly build Project B with the dependency of Project A in pom file I am getting compilation issues as the jar file is getting loaded from project repo.

Expected dependency (jar file) is available in the.m2 repository with the specified version and if I extract the jar file I am able to see the implementation classes but that is not getting recognized by my project while doing maven build.

Thanks in advance!

I just ran into the same problem. Project B has a dependency on project A, and they both have a common parent P. mvn clean package (local) worked fine with different versions for P in each project.

My Jenkins build failed on the maven-compiler-plugin, even though the plugin version as well as java-source and target versions were the same in both versions of the parent POM.

I fixed the build failure by updating both projects to the same version of the parent.

adding this in pom, worked for me

 <execution>
        <id>repackage</id>
        <configuration>
          <classifier>exec</classifier>
        </configuration>
      </execution>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM