When is mvnw used

What is the difference between mvn and mvnw builds?
When should mvnw be used?
Current documentation does not provide any guidance.

There’s basically no technical difference using mvn or mvnw. The maven wrapper simplifies getting started because the project has all it needs to be built.

Maven wrapper will download what’s need.

When running on your local system mvn and mvnw may use different versions, but the version used by wrapper can be configured in the properties file present in the .mvn project folder.

More about maven wrapper here Apache Maven Wrapper – Maven Wrapper

3 Likes

@marcoc_753
Thanks for your reply and link, Marco,
Much clearer now.
Am I correct in assuming that mvnw is specified for new starter projects as it ensures all the maven requirements are already available for first build of the new project?

Am I correct in assuming that mvnw is specified for new starter projects as it ensures all the maven requirements are already available for first build of the new project?

I would say yes. With the wrapper, you only need a JDK pre-installed on the system to build the project.

I always use the Maven wrapper. Also because with it the build system doesn’t need a Maven installation.

You can add the wrapper to existing projects

https://maven.apache.org/wrapper/