How to change the version of mvnw from the command line?

Asked

Viewed 136 times

1

I need to change the version of mvnw to the 3.5.0 or higher. I am using a maven-wrapper inherited from another project (copied and pasted), but it is in the version 3.3.9.

How to make this change in the command line?

I am asking this question as a support to the last paragraph of this answer, because it is easier to manipulate the maven-wrapper than the local Maven facility

Issue purposely similar to this on gradlew

  • No use spamming questions now...

1 answer

1


Just invoke the maven-wrapper-plugin. Got it from the tutorial by Baeldung the following line:

$ mvn -N io.takari:maven:wrapper -Dmaven=3.5.2

....

[INFO] --- maven:0.7.6:wrapper (default-cli) @ project ---
[INFO]
[INFO] Maven Wrapper version 0.5.5 has been successfully set up for your project.
[INFO] Using Apache Maven: 3.5.2
[INFO] Repo URL in properties file: https://repo.maven.apache.org/maven2
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.722 s
[INFO] Finished at: 2019-11-13T16:01:22-03:00
[INFO] Final Memory: 7M/153M
[INFO] ------------------------------------------------------------------------

The version of mvnw for 3.5.2. The git diff identifies that change as well:

$ git diff

diff --git a/.mvn/wrapper/maven-wrapper.jar b/.mvn/wrapper/maven-wrapper.jar
index 5fd4d50..0d5e649 100644
Binary files a/.mvn/wrapper/maven-wrapper.jar and b/.mvn/wrapper/maven-wrapper.jar differ
diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties
index c954cec..cc805cc 100644
--- a/.mvn/wrapper/maven-wrapper.properties
+++ b/.mvn/wrapper/maven-wrapper.properties
@@ -1 +1,2 @@
-distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.3.9/apache-maven-3.3.9-bin.zip
+distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.5.2/apache-maven-3.5.2-bin.zip
+wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar
... [outras coisas do meu repositório que foram alteradas] ...

Browser other questions tagged

You are not signed in. Login or sign up in order to post.