I have Maven 3.5.4 and it's probably not the latest, because I'm having problem when I'm trying to build "mvn clean install" my project.
So my question is how do I update Maven to the latest version?
Nowhere in the internet I found an answer to this simple question!
And why in IDE (IntelliJ Idea) I can build my project, but in CMD I can't? Do they have different Maven versions?
If you are using the maven wrapper you can update the version with (from the root of your project directory):
./mvnw -N wrapper:wrapper -Dmaven=3.8.7
(3.8.7 is the desired version).
Complete example:
$ ./mvnw --version
Apache Maven 3.8.4 (9b656c72d54e5bacbed989b64718c159fe39b537)
...
$ ./mvnw -N wrapper:wrapper -Dmaven=3.8.7
...
$ ./mvnw --version
Apache Maven 3.8.7 (b89d5959fcde851dcb1c8946a785a163f14e1e29)
This will update .mvn/wrapper/maven-wrapper.properties to use the correct version and download it to ~/.m2/wrapper/dists/.
And SKDMAN! is also highly recommended, see answer @marvi
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With