1

I am using Maven for a new Java project. After generating the project using one of the Maven artifacts, I've tried to generate Maven wrapper scripts inside the project. For this purpose I am using the new Maven plugin and goal wrapper:wrapper, however I am getting the following error: wrapperVersion not supported for Maven 3.8.1, it must be at least 4

mvn wrapper:wrapper                                                                                                                      ⇣82.8 KiB/s ⇡2.76 KiB/s 192.168.2.110   77.29.199.151   100%  ─╯
[INFO] Scanning for projects...
[INFO] 
[INFO] ---------------------------< com.angel:demo >---------------------------
[INFO] Building demo 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-wrapper-plugin:3.0.2:wrapper (default-cli) @ demo ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.897 s
[INFO] Finished at: 2021-05-27T16:14:23+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-wrapper-plugin:3.0.2:wrapper (default-cli) on project demo: wrapperVersion not supported for Maven 3.8.1, it must be at least 4. -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

Java Version:

openjdk 11.0.11 2021-04-20 OpenJDK Runtime Environment (build 11.0.11+9) OpenJDK 64-Bit Server VM (build 11.0.11+9, mixed mode)

Maven version:

Apache Maven 3.8.1 (NON-CANONICAL_2021-04-26T21:52:54Z_root) Maven home: /opt/maven Java version: 11.0.11, vendor: Oracle Corporation, runtime: /usr/lib/jvm/java-11-openjdk Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "5.12.4-arch1-2", arch: "amd64", family: "unix"

OS version: Arch Linux Maven should contain the wrapper script starting from Maven 3.7, which shouldn't be a problem because I am using Maven 3.8, but the error message for version 4 is confusing for me and I have no idea where to look for answers.

2 Answers2

2

Sometimes the answer is in front of us, but tired eyes can make us blind :D

As @JFabianMeier said, there is no Maven 3.7 and Maven wrapper scripts are included starting from Maven 4.0

https://maven.apache.org/plugins/maven-wrapper-plugin/

  • 2
    Also the fact that they did actually [renamed](https://maven.apache.org/docs/3.8.1/release-notes.html#why-does-this-version-have-the-value-3-8-1) 3.7 to 4.0. This could explain why some docs still claim that this feature is available starting from 3.7. The quote: _Apache Maven 3.7.0 has been advertised in the past that it would be the first release where you could optionally activate the build/consumer feature: the version containing this feature has been renamed to 4.0.0._ – Ruslan Stelmachenko Jun 09 '21 at 15:28
1

For your project you can still use Takari Maven Wrapper plugin. It is needed for any project with Maven version before 4.0.0.

vbg
  • 613
  • 6
  • 10