JoyOfCoding
JoyOfCoding copied to clipboard
Use the new/real Maven Wrapper
It looks like Maven wrapper has been promoted to be a first-class citizen in Maven:
https://maven.apache.org/plugins/maven-wrapper-plugin/index.html
I should recreate the Maven wrapper scripts and jars using that plugin.
Or maybe not. After upgrading to the latest Maven, I tried running the wrapper:wrapper
plugin and I got this error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-wrapper-plugin:3.0.2:wrapper (default-cli) on project student: wrapperVersion not supported for Maven 3.8.1, it must be at least 4. -> [Help 1]
So, this doesn't look like it's quite ready for primetime yet.
It might be worth giving this a try again.
https://maven.apache.org/wrapper/
https://www.baeldung.com/maven-wrapper
So, it looks like this might do the trick:
mvn -N wrapper:wrapper
No dice.
It looks like the official Maven Wrapper plugin still requires Maven 4:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-wrapper-plugin:3.0.2:wrapper (default-cli) on project cs410j: wrapperVersion not supported for Maven 3.8.5, it must be at least 4. -> [Help 1]
I had the same error and have been looking for a long time for a solution. Finally, I found it.
When you just call the goal with wrapper:wrapper
, for some reason version 3.0.2 of the plugin is used although there are only higher versions available on Maven Central.
If you call the goal explicitly with the latest plugin version, it works:
mvn org.apache.maven.plugins:maven-wrapper-plugin:3.1.1:wrapper
Awesome! Thanks for letting me know. I'll give this a try when I start preparing for the Winter offering of my course.
You're welcome! I imagine providing a controlled environment is especially useful in the context of Java courses.
It's definitely a blessing for me who was otherwise stuck on a not-so-recent Maven version from the Ubuntu LTS repository which doesn't work with the latest Java versions.
Well, the Gilded Rose kata uses the Apache Maven Wrapper: https://github.com/emilybache/GildedRose-Refactoring-Kata/commit/0eab1974d7d8e4924f825885f00c6f5a8e26dd98
So, we should be able to, also.