Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java maven rebuild dependency

I have a project which has dependency A. Project is packing into WAR and dependency A - into jar. And another dependency B, which also depends on A. I want to pack project and when project B is packing it must rebuild its dependency A instead of getting compiled dependency. Please help, how can i achieve this

like image 631
jdevrr Avatar asked Dec 06 '10 14:12

jdevrr


People also ask

How do I force Maven to update dependencies?

We can force update in maven by using –U options by using mvn clean install command. In that –U means force update the dependencies of the snapshot. The release dependencies are updated is suppose there are not updated previously.

Does Maven clean remove dependencies?

mvn clean do not clean your repository. It only cleans the project. Save this answer.

How do I reset a .m2 folder?

Just open eclipse-->window-->preferences-->maven-->user settings-->in there see "local repository location". then find the location for your . m2/repository folder then delete that folder if your maven doesn't work properly.


2 Answers

What you may want is a multi-module project containing your three projects (WAR, A and B). Then you can run mvn package on the multi-module project and it will build and package all of the latest project code against each other without having to run mvn install to update the dependencies in your local repository first.

like image 196
trask Avatar answered Oct 14 '22 21:10

trask


Always perform a clean when doing an install, ie mvn clean install. This will make sure that all modules in the project are rebuilt, packaged, and installed in the local .m2 repository for inclusion by parent dependencies and projects.

like image 33
jgifford25 Avatar answered Oct 14 '22 22:10

jgifford25