This is an automated email from the ASF dual-hosted git repository. cstamas pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/maven-wrapper.git
The following commit(s) were added to refs/heads/master by this push: new 9525271 [MWRAPPER-125] Make only-script the default (#127) 9525271 is described below commit 95252715e72e76eb1227da2f0bed12f03662526f Author: Tamas Cservenak <ta...@cservenak.net> AuthorDate: Wed Apr 17 11:11:15 2024 +0200 [MWRAPPER-125] Make only-script the default (#127) This makes only-script the default. --- https://issues.apache.org/jira/browse/MWRAPPER-125 --- maven-wrapper-plugin/src/it/projects/default/verify.groovy | 3 +-- .../src/it/projects/mavenversion-empty1/verify.groovy | 2 +- .../src/it/projects/mavenversion-empty2/verify.groovy | 2 +- .../src/it/projects/mavenversion/verify.groovy | 2 +- .../src/it/projects/sha256_distribution/test.properties | 1 + .../src/it/projects/sha256_wrapper/test.properties | 1 + .../java/org/apache/maven/plugins/wrapper/WrapperMojo.java | 6 +++--- maven-wrapper-plugin/src/site/markdown/usage.md | 4 ++-- src/site/markdown/index.md | 10 +++++----- 9 files changed, 16 insertions(+), 15 deletions(-) diff --git a/maven-wrapper-plugin/src/it/projects/default/verify.groovy b/maven-wrapper-plugin/src/it/projects/default/verify.groovy index fce6dda..c1a1aa1 100644 --- a/maven-wrapper-plugin/src/it/projects/default/verify.groovy +++ b/maven-wrapper-plugin/src/it/projects/default/verify.groovy @@ -23,10 +23,9 @@ assert new File(basedir,'mvnw.cmd').exists() assert !(new File(basedir,'mvnwDebug').exists()) assert !(new File(basedir,'mvnwDebug.cmd').exists()) assert new File(basedir,'.mvn/wrapper/maven-wrapper.properties').exists() -assert new File(basedir,'.mvn/wrapper/maven-wrapper.jar').exists() log = new File(basedir, 'build.log').text // check "mvn wrapper:wrapper" output -assert log.contains('[INFO] Unpacked bin type wrapper distribution org.apache.maven.wrapper:maven-wrapper-distribution:zip:bin:') +assert log.contains('[INFO] Unpacked only-script type wrapper distribution org.apache.maven.wrapper:maven-wrapper-distribution:zip:only-script:') // check "mvnw -v" output assert log.contains('Apache Maven ') diff --git a/maven-wrapper-plugin/src/it/projects/mavenversion-empty1/verify.groovy b/maven-wrapper-plugin/src/it/projects/mavenversion-empty1/verify.groovy index 0ee5d42..ba74a1e 100644 --- a/maven-wrapper-plugin/src/it/projects/mavenversion-empty1/verify.groovy +++ b/maven-wrapper-plugin/src/it/projects/mavenversion-empty1/verify.groovy @@ -36,6 +36,6 @@ assert mavenVersion1 == mavenVersion2 log = new File( basedir, 'build.log' ).text // check "mvn wrapper:wrapper" output -assert log.contains( '[INFO] Unpacked bin type wrapper distribution org.apache.maven.wrapper:maven-wrapper-distribution:zip:bin:' ) +assert log.contains( '[INFO] Unpacked only-script type wrapper distribution org.apache.maven.wrapper:maven-wrapper-distribution:zip:only-script:' ) // check "mvnw -v" output assert log.contains( 'Apache Maven ' + mavenVersion1 ) diff --git a/maven-wrapper-plugin/src/it/projects/mavenversion-empty2/verify.groovy b/maven-wrapper-plugin/src/it/projects/mavenversion-empty2/verify.groovy index 0ee5d42..ba74a1e 100644 --- a/maven-wrapper-plugin/src/it/projects/mavenversion-empty2/verify.groovy +++ b/maven-wrapper-plugin/src/it/projects/mavenversion-empty2/verify.groovy @@ -36,6 +36,6 @@ assert mavenVersion1 == mavenVersion2 log = new File( basedir, 'build.log' ).text // check "mvn wrapper:wrapper" output -assert log.contains( '[INFO] Unpacked bin type wrapper distribution org.apache.maven.wrapper:maven-wrapper-distribution:zip:bin:' ) +assert log.contains( '[INFO] Unpacked only-script type wrapper distribution org.apache.maven.wrapper:maven-wrapper-distribution:zip:only-script:' ) // check "mvnw -v" output assert log.contains( 'Apache Maven ' + mavenVersion1 ) diff --git a/maven-wrapper-plugin/src/it/projects/mavenversion/verify.groovy b/maven-wrapper-plugin/src/it/projects/mavenversion/verify.groovy index ff4e3e0..0f79fd6 100644 --- a/maven-wrapper-plugin/src/it/projects/mavenversion/verify.groovy +++ b/maven-wrapper-plugin/src/it/projects/mavenversion/verify.groovy @@ -35,6 +35,6 @@ assert props.distributionUrl.endsWith('/org/apache/maven/apache-maven/3.6.3/apac log = new File(basedir, 'build.log').text // check "mvn wrapper:wrapper" output -assert log.contains('[INFO] Unpacked bin type wrapper distribution org.apache.maven.wrapper:maven-wrapper-distribution:zip:bin:') +assert log.contains('[INFO] Unpacked only-script type wrapper distribution org.apache.maven.wrapper:maven-wrapper-distribution:zip:only-script:') // check "mvnw -v" output assert log.contains('Apache Maven 3.6.3') diff --git a/maven-wrapper-plugin/src/it/projects/sha256_distribution/test.properties b/maven-wrapper-plugin/src/it/projects/sha256_distribution/test.properties index ed4403b..c8a102d 100644 --- a/maven-wrapper-plugin/src/it/projects/sha256_distribution/test.properties +++ b/maven-wrapper-plugin/src/it/projects/sha256_distribution/test.properties @@ -16,4 +16,5 @@ # under the License. alwaysUnpack=true +type=bin distributionSha256Sum=7e0c63c6a99639e57cc64375d6717d72e301d8ab829fef2e145ee860317bc3cb \ No newline at end of file diff --git a/maven-wrapper-plugin/src/it/projects/sha256_wrapper/test.properties b/maven-wrapper-plugin/src/it/projects/sha256_wrapper/test.properties index 65d36cb..64dd855 100644 --- a/maven-wrapper-plugin/src/it/projects/sha256_wrapper/test.properties +++ b/maven-wrapper-plugin/src/it/projects/sha256_wrapper/test.properties @@ -15,4 +15,5 @@ # specific language governing permissions and limitations # under the License. +type=bin wrapperSha256Sum=7e0c63c6a99639e57cc64375d6717d72e301d8ab829fef2e145ee860317bc3cb \ No newline at end of file diff --git a/maven-wrapper-plugin/src/main/java/org/apache/maven/plugins/wrapper/WrapperMojo.java b/maven-wrapper-plugin/src/main/java/org/apache/maven/plugins/wrapper/WrapperMojo.java index b957f26..9aeaa72 100644 --- a/maven-wrapper-plugin/src/main/java/org/apache/maven/plugins/wrapper/WrapperMojo.java +++ b/maven-wrapper-plugin/src/main/java/org/apache/maven/plugins/wrapper/WrapperMojo.java @@ -88,18 +88,18 @@ public class WrapperMojo extends AbstractMojo { * <dl> * <dt>script</dt> * <dd>only mvnw scripts</dd> - * <dt>bin (default)</dt> + * <dt>bin</dt> * <dd>precompiled and packaged code</dd> * <dt>source</dt> * <dd>Java source code, will be compiled on the fly</dd> - * <dt>only-script</dt> + * <dt>only-script (default)</dt> * <dd>the new lite implementation of mvnw/mvnw.cmd scripts downloads the maven directly and skips maven-wrapper.jar - since 3.2.0</dd> * </dl> * Value will be used as classifier of the downloaded file * * @since 3.0.0 */ - @Parameter(defaultValue = "bin", property = "type") + @Parameter(defaultValue = "only-script", property = "type") private String distributionType; /** diff --git a/maven-wrapper-plugin/src/site/markdown/usage.md b/maven-wrapper-plugin/src/site/markdown/usage.md index fdf266a..3c22bca 100644 --- a/maven-wrapper-plugin/src/site/markdown/usage.md +++ b/maven-wrapper-plugin/src/site/markdown/usage.md @@ -34,13 +34,13 @@ Apache Maven Wrapper Distribution Types There are 4 types available: -- **only-script**: the lite implementation of `mvnw`/`mvnw.cmd` scripts will download the maven directly via wget or curl on *nix, or PowerShell on Windows, +- **only-script** _(default)_: the lite implementation of `mvnw`/`mvnw.cmd` scripts will download the maven directly via wget or curl on *nix, or PowerShell on Windows, then exec/call the original `mvn`/`mvn.cmd` scripts of the downloaded maven distribution. This type does not use `maven-wrapper.jar` nor `MavenWrapperDownloader.java`, only the wrapper scripts are required. - **script**: With this type the scripts will try to download the scripts via wget or curl in case of Unix based system, or use Powershell in case of Windows -- **bin** _(default)_: With this type the maven-wrapper jar is already available in the `.mvn/wrapper` folder, so you don't have to rely on wget/curl or Powershell +- **bin**: With this type the maven-wrapper jar is already available in the `.mvn/wrapper` folder, so you don't have to rely on wget/curl or Powershell The downside is that the project will contain a binary file in the source control management system. - **source**: Since Maven already requires Java to run, why not compile and run a classfile to download the maven-wrapper jar? diff --git a/src/site/markdown/index.md b/src/site/markdown/index.md index b3fb504..50a52ee 100644 --- a/src/site/markdown/index.md +++ b/src/site/markdown/index.md @@ -78,7 +78,7 @@ In terms of Apache Maven versions itself, the wrapper should work with any Maven 3.x version and it defaults to the release used when setting up the wrapper. We do NOT plan to support the deprecated, EOL'ed Maven 2.x. -The `maven-wrapper.jar` (to download and install target Maven version required by `mvnw`) and the Maven Wrapper Plugin (to inject Wrapper into a project) use Java 7. +By default, the `only-script` type is installed (see below). ## Verbose Mode @@ -87,9 +87,9 @@ is activated by setting the `MVNW_VERBOSE` environment variable to `true`. By default it is off. -## Usage without Binary JAR +## Usage with or without Binary JAR -By default, the Maven Wrapper JAR archive is added to the using project as small +Using `type=bin`, the Maven Wrapper JAR archive is added to the using project as small binary file `.mvn/wrapper/maven-wrapper.jar`. It is used to bootstrap the download and invocation of Maven from the wrapper shell scripts. @@ -98,11 +98,10 @@ use the source distribution of the maven wrapper which adds a file `.mvn/wrapper/MavenWrapperDownloader.java` file instead: ```shell -# defaults to bin mvn wrapper:wrapper -Dtype=source ``` -You can also chose to opt out of all additional resources except the wrapper scripts: +You can also choose to opt out of all additional resources except the wrapper scripts: ```shell mvn wrapper:wrapper -Dtype=script @@ -112,6 +111,7 @@ Another type is the lite implementation of `mvnw`/`mvnw.cmd` scripts which downl via wget or curl on *nix, or PowerShell on Windows, then call the original `mvn`/`mvn.cmd` scripts of the downloaded maven distribution. This type does not use `maven-wrapper.jar` nor `MavenWrapperDownloader.java`, only the wrapper scripts are required. +This is the default type being installed, when no type parameter is specified. ```shell mvn wrapper:wrapper -Dtype=only-script