Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven dependency update on commandline

I have a maven project that was built on the commandline for eclipse and one of the dependencies is constantly changing. How do I update this dependency on the commandline as I have heard that it is a bad idea to mix m2e plugin and commandline. Furthermore, I tried running mvn eclipse:eclipse on the command line and it messes up the project in eclipse removing the dependencies folder.

like image 658
cobie Avatar asked Jan 20 '14 16:01

cobie


People also ask

How do I update my Maven?

icon in the Maven tool window to open the Maven settings. Select Repositories from options on the left. On the Repositories page, click Update to update Maven repositories. After the update is finished, click OK.

How do I force a Maven project to update in Eclipse?

You can right-click on your project then Maven > Update Project..., then select Force Update of Snapshots/Releases checkbox then click OK.


2 Answers

mvn clean install -U 

-U means force update of dependencies.

Also, if you want to import the project into eclipse, I first run:

mvn eclipse:eclipse 

then run

mvn eclipse:clean 

Seems to work for me, but that's just my pennies worth.

like image 142
Ben Dale Avatar answered Sep 21 '22 03:09

Ben Dale


If you just want to re-load/update dependencies (I assume, with constantly changing you mean either SNAPSHOTS or local dependencies you update yourself), you can use

mvn dependency:resolve 
like image 37
user2039709 Avatar answered Sep 21 '22 03:09

user2039709