简体   繁体   中英

Issue while adding a new maven module to a maven project

I've added a new maven module B to an existing maven project A.

Apart from module B, A contains additional 2 modules C & D.

I've properly defined the module B inside parent pom.xml.

I've also added the parent tag inside module B pom.xml. The versions of all the modules as the parent are 0.0.X-SNAPSHOT.

Now when I do a mvn clean install deploy , it always throws exception:

Failed to create archive: Could not find artifact B:jar:0.0.X-SNAPSHOT in central ( https://nexus.xyz.com/content/groups/public ) ,which kind-off makes sense.

Hence,as a last resort, I tried to manually push the file into the nexus repo using using mvn deploy:deploy-file command.

Now, if I again do mvn clean install deploy ,it works smoothly.

But the problem re-appears when I try to release the project. This time, it complains:

Failed to create archive: Could not find artifact B:jar:0.0.X in central ( https://nexus.xyz.com/content/groups/public )

I tried with mvn clean install -U as well but in vain.

The problem doesn't appear for any other modules. Kindly advise.Thanks.

Okay...after fiddling around with all sort of permutations and combination, I finally arrived at the conclusion. Those who says that the reactor automatically sorts and resolves all dependencies on its own are incorrect. It seems that the link below describes it all. Kindly look at the last point under "Reactor Sorting" section:

https://maven.apache.org/guides/mini/guide-multiple-modules.html#Reactor_Sorting

It suggests that the order in which the modules are defined are taken into consideration when no other rules applies.

I hope that helps other. :)

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