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.

1

6 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.

0

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

Simple run your project online i.e mvn clean install . It fetches all the latest dependencies that you mention in your pom.xml and built the project

2
mvn clean install -U 

also make sure if you have your dependencies behind a VPN, you are connected to that VPN

I recently stumbled upon an error in IntelliJ IDEA. Which arise, when I checkout in git an older branch which is uses older dependency versions in the pom.xml.

My codebase is getting littered with java: package com.foo.bar does not exist and

java: cannot find symbol symbol: class Baz location: class com.foo.bar

error messages.

The solution is to reload the project in the maven tab.

I tried to automate that, but it seems that it is due to the fact, that IntelliJ is not noticing, that these files need to be indexed.

Hope that this helps someone. And if someone got to know how to update that over the console or as an pre-run task, please let me know.

mvn -Dschemaname=public liquibase:update

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like