maven dependency problem when jenkins builds the project

我与影子孤独终老i 提交于 2019-12-11 10:47:24

问题


I have two maven projects, let's say A and B, merely A requires B, reverse is not true. There is no problem when I package A from eclipse. In the "pom.xml" of the project A has a dependency node on B. In jenkins, I configured the project B by adding three goals, which are "clean package install". Therefore, whenever the build of B finishes, it must be exist the archive file of the B in my local maven repository that there is(I checked it). On the other hand, when I build the project A, I got lots of compilation errors "cannot find symbol x". What might be the problem, any ideas?

Thanks in advance.


回答1:


Just to make sure: You looked into ~jenkins/.m2/repository/, yes?

Note that install always includes package, so clean install is enough.

But the problem is elsewhere.

  1. Check that the versions are the same. Use an exact version number in the dependency of A, not a version range to make sure what it picks up (otherwise, Maven might find a "more suitable" version).

  2. If the dependency wasn't there, Maven wouldn't start the compiler (because building the classpath would fail). So the problem is not the JAR file but the content. Make sure that B's JAR file really contains what you expect (jar tvf is your friend).

  3. Delete the repository on the Jenkins server to make sure there is no old junk in there.



来源:https://stackoverflow.com/questions/7362858/maven-dependency-problem-when-jenkins-builds-the-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!