1

Hi I've searched the net, read a bunch of articles, so questions and documentation but I can not find solution, here is my problem.

I have a multimodule maven project which contains three modules A,B and C. A and B independent and C is depend on A and B, and of course I have a parent project. I also have a jenkins server set up to build these projects, and a nexus repository.

My problem is that when I build the project the maven builds A and B correctly but for C it downloads an older artifact from the nexus repository and of course it fails to build module C. How can I make the maven to use the currently built jars which installed into the local repository instead of the older ones on nexus?

Version of A and B and C set to 1.1.{build_number}-SNAPSHOT with maven version plugin, and as I understand maven should use the newer from local but it does not do it. Initially I do not want to post hundreds of lines of pom.xmls but if you need section I will provide it.

Any help would be appreciated. Thank You!

Bowdzone
  • 3,827
  • 11
  • 39
  • 52
Tibor Bana
  • 11
  • 2
  • I'm using Jenkins and Artifactory, and when I build a multimodule project, Maven first has a look to the local Maven repo (.m2/repository). Next, when the build is OK, the binaries (A, B and C) are uploaded into Artifactory. Maybe you have an option with Jenkins/Nexus to use the local repo instead of the remote repo? – Bruno Lavit Jun 25 '15 at 12:31
  • Hi Bruno thanks for your answer. I want exactly what you are doing, but somehow maven in my case ignores the local repository and I can not figure it out how to make it use the currently built artifacts. Any idea where should I look? – Tibor Bana Jun 25 '15 at 12:41
  • Maybe this answer can help: http://stackoverflow.com/questions/19180696/maven-not-using-local-repository – Bruno Lavit Jun 25 '15 at 12:58
  • Maven refreshs the local dependency one time per day, so maybe you just have to change this setting: http://stackoverflow.com/questions/2148111/maven-snapshot-updates – Bruno Lavit Jun 25 '15 at 13:03
  • Hi it was set to always but I set tot never right now to prevent downloading of snpashot artifacts but still the newer artifact in my local repo is being ignored. – Tibor Bana Jun 25 '15 at 13:15
  • If you build on your machine, you confirm that the build result is OK? – Bruno Lavit Jun 25 '15 at 14:29
  • The best test for a multi module project is to clean the local repository and just run `mvn clean package` if something goes wrong your build is not configured well. That's what i would check first. – khmarbaise Jun 25 '15 at 15:14
  • Totally agree with @khmarbaise .. most likely your multi module projects has an incorrect setup that prevents the Maven reactor from resolving A and B from C within the project correctly. – Manfred Moser Jun 25 '15 at 19:12
  • You should post your own solution as an answer and accept it. – Manfred Moser Jun 26 '15 at 18:16

1 Answers1

0

I have been setting the version numbers in the submodule's poms and changed to inherit version number from parent pom. In module C's pom module A and B versions set to ${project.version}

Bowdzone
  • 3,827
  • 11
  • 39
  • 52