This is an automated email from the ASF dual-hosted git repository. hboutemy pushed a commit to branch it_run_mvnw in repository https://gitbox.apache.org/repos/asf/maven-wrapper.git
commit 4d7c5eb16cd55a3219e030e613319af91c74bf26 Author: Hervé Boutemy <[email protected]> AuthorDate: Fri Dec 10 18:52:39 2021 +0100 run mvnw during ITs to check it works --- maven-wrapper-plugin/pom.xml | 19 +++++++++++ .../src/it/projects/default/pom.xml | 37 ++++++++++++++++++++++ .../src/it/projects/default/verify.groovy | 7 +++- .../src/it/projects/includeDebug/pom.xml | 37 ++++++++++++++++++++++ .../src/it/projects/mavenversion/pom.xml | 37 ++++++++++++++++++++++ .../src/it/projects/mavenversion/verify.groovy | 8 ++++- .../src/it/projects/type_bin/pom.xml | 37 ++++++++++++++++++++++ .../src/it/projects/type_bin/verify.groovy | 8 ++++- .../src/it/projects/type_script/invoker.properties | 19 ----------- .../src/it/projects/type_script/pom.xml | 37 ++++++++++++++++++++++ .../src/it/projects/type_script/verify.groovy | 7 ++-- .../src/it/projects/type_source/invoker.properties | 19 ----------- .../src/it/projects/type_source/pom.xml | 37 ++++++++++++++++++++++ .../src/it/projects/type_source/verify.groovy | 7 ++-- maven-wrapper-plugin/src/it/settings.xml | 26 ++++++++++++--- .../apache/maven/plugins/wrapper/WrapperMojo.java | 2 +- 16 files changed, 292 insertions(+), 52 deletions(-) diff --git a/maven-wrapper-plugin/pom.xml b/maven-wrapper-plugin/pom.xml index d5b7686..c0ecf82 100644 --- a/maven-wrapper-plugin/pom.xml +++ b/maven-wrapper-plugin/pom.xml @@ -106,12 +106,27 @@ under the License. <build> <plugins> <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>mrm-maven-plugin</artifactId> + <version>1.3.0</version> + <executions> + <execution> + <id>mrm</id> + <goals> + <goal>start</goal> + <goal>stop</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-invoker-plugin</artifactId> <version>3.2.2</version> <configuration> <goals> <goal>${project.groupId}:${project.artifactId}:${project.version}:wrapper</goal> + <goal>exec:exec</goal> </goals> <projectsDirectory>src/it/projects</projectsDirectory> <debug>false</debug> @@ -130,6 +145,10 @@ under the License. <https.protocols>${https.protocols}</https.protocols> </properties> <ignoreFailures>${maven.it.failure.ignore}</ignoreFailures> + <streamLogsOnFailures>true</streamLogsOnFailures> + <filterProperties> + <mrm.repository.url>${mrm.repository.url}</mrm.repository.url> + </filterProperties> </configuration> <executions> <execution> diff --git a/maven-wrapper-plugin/src/it/projects/default/pom.xml b/maven-wrapper-plugin/src/it/projects/default/pom.xml index ed54d55..cbec1de 100644 --- a/maven-wrapper-plugin/src/it/projects/default/pom.xml +++ b/maven-wrapper-plugin/src/it/projects/default/pom.xml @@ -26,4 +26,41 @@ under the License. <artifactId>extension</artifactId> <version>1.0.0-SNAPSHOT</version> <packaging>pom</packaging> + + <properties> + <cmd></cmd> + </properties> + + <build> + <pluginManagement> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>exec-maven-plugin</artifactId> + <version>3.0.0</version> + <configuration> + <executable>mvnw${cmd}</executable> + <arguments> + <argument>-v</argument> + </arguments> + <environmentVariables> + <MVNW_VERBOSE>true</MVNW_VERBOSE> + </environmentVariables> + </configuration> + </plugin> + </plugins> + </pluginManagement> + </build> + + <profiles> + <profile> + <id>windows</id> + <activation> + <os><family>windows</family></os> + </activation> + <properties> + <cmd>.cmd</cmd> + </properties> + </profile> + </profiles> </project> \ No newline at end of file diff --git a/maven-wrapper-plugin/src/it/projects/default/verify.groovy b/maven-wrapper-plugin/src/it/projects/default/verify.groovy index 46a6f78..fce6dda 100644 --- a/maven-wrapper-plugin/src/it/projects/default/verify.groovy +++ b/maven-wrapper-plugin/src/it/projects/default/verify.groovy @@ -24,4 +24,9 @@ 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() -assert new File(basedir, 'build.log').text.contains('[INFO] Unpacked bin type wrapper distribution org.apache.maven.wrapper:maven-wrapper-distribution:zip:bin:') \ No newline at end of file + +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:') +// check "mvnw -v" output +assert log.contains('Apache Maven ') diff --git a/maven-wrapper-plugin/src/it/projects/includeDebug/pom.xml b/maven-wrapper-plugin/src/it/projects/includeDebug/pom.xml index ed54d55..cbec1de 100644 --- a/maven-wrapper-plugin/src/it/projects/includeDebug/pom.xml +++ b/maven-wrapper-plugin/src/it/projects/includeDebug/pom.xml @@ -26,4 +26,41 @@ under the License. <artifactId>extension</artifactId> <version>1.0.0-SNAPSHOT</version> <packaging>pom</packaging> + + <properties> + <cmd></cmd> + </properties> + + <build> + <pluginManagement> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>exec-maven-plugin</artifactId> + <version>3.0.0</version> + <configuration> + <executable>mvnw${cmd}</executable> + <arguments> + <argument>-v</argument> + </arguments> + <environmentVariables> + <MVNW_VERBOSE>true</MVNW_VERBOSE> + </environmentVariables> + </configuration> + </plugin> + </plugins> + </pluginManagement> + </build> + + <profiles> + <profile> + <id>windows</id> + <activation> + <os><family>windows</family></os> + </activation> + <properties> + <cmd>.cmd</cmd> + </properties> + </profile> + </profiles> </project> \ No newline at end of file diff --git a/maven-wrapper-plugin/src/it/projects/mavenversion/pom.xml b/maven-wrapper-plugin/src/it/projects/mavenversion/pom.xml index ed54d55..cbec1de 100644 --- a/maven-wrapper-plugin/src/it/projects/mavenversion/pom.xml +++ b/maven-wrapper-plugin/src/it/projects/mavenversion/pom.xml @@ -26,4 +26,41 @@ under the License. <artifactId>extension</artifactId> <version>1.0.0-SNAPSHOT</version> <packaging>pom</packaging> + + <properties> + <cmd></cmd> + </properties> + + <build> + <pluginManagement> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>exec-maven-plugin</artifactId> + <version>3.0.0</version> + <configuration> + <executable>mvnw${cmd}</executable> + <arguments> + <argument>-v</argument> + </arguments> + <environmentVariables> + <MVNW_VERBOSE>true</MVNW_VERBOSE> + </environmentVariables> + </configuration> + </plugin> + </plugins> + </pluginManagement> + </build> + + <profiles> + <profile> + <id>windows</id> + <activation> + <os><family>windows</family></os> + </activation> + <properties> + <cmd>.cmd</cmd> + </properties> + </profile> + </profiles> </project> \ No newline at end of file diff --git a/maven-wrapper-plugin/src/it/projects/mavenversion/verify.groovy b/maven-wrapper-plugin/src/it/projects/mavenversion/verify.groovy index be0e5b4..ff4e3e0 100644 --- a/maven-wrapper-plugin/src/it/projects/mavenversion/verify.groovy +++ b/maven-wrapper-plugin/src/it/projects/mavenversion/verify.groovy @@ -31,4 +31,10 @@ propertiesFile.withInputStream { props.load(it) } -assert props.distributionUrl == 'https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip' +assert props.distributionUrl.endsWith('/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip') + +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:') +// check "mvnw -v" output +assert log.contains('Apache Maven 3.6.3') diff --git a/maven-wrapper-plugin/src/it/projects/type_bin/pom.xml b/maven-wrapper-plugin/src/it/projects/type_bin/pom.xml index ed54d55..cbec1de 100644 --- a/maven-wrapper-plugin/src/it/projects/type_bin/pom.xml +++ b/maven-wrapper-plugin/src/it/projects/type_bin/pom.xml @@ -26,4 +26,41 @@ under the License. <artifactId>extension</artifactId> <version>1.0.0-SNAPSHOT</version> <packaging>pom</packaging> + + <properties> + <cmd></cmd> + </properties> + + <build> + <pluginManagement> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>exec-maven-plugin</artifactId> + <version>3.0.0</version> + <configuration> + <executable>mvnw${cmd}</executable> + <arguments> + <argument>-v</argument> + </arguments> + <environmentVariables> + <MVNW_VERBOSE>true</MVNW_VERBOSE> + </environmentVariables> + </configuration> + </plugin> + </plugins> + </pluginManagement> + </build> + + <profiles> + <profile> + <id>windows</id> + <activation> + <os><family>windows</family></os> + </activation> + <properties> + <cmd>.cmd</cmd> + </properties> + </profile> + </profiles> </project> \ No newline at end of file diff --git a/maven-wrapper-plugin/src/it/projects/type_bin/verify.groovy b/maven-wrapper-plugin/src/it/projects/type_bin/verify.groovy index 40cba0e..fce6dda 100644 --- a/maven-wrapper-plugin/src/it/projects/type_bin/verify.groovy +++ b/maven-wrapper-plugin/src/it/projects/type_bin/verify.groovy @@ -23,4 +23,10 @@ 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() \ No newline at end of file +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:') +// check "mvnw -v" output +assert log.contains('Apache Maven ') diff --git a/maven-wrapper-plugin/src/it/projects/type_script/invoker.properties b/maven-wrapper-plugin/src/it/projects/type_script/invoker.properties deleted file mode 100644 index 68fdc5e..0000000 --- a/maven-wrapper-plugin/src/it/projects/type_script/invoker.properties +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -invoker.debug = true -invoker.environmentVariables.MVNW_REPOURL = @localRepositoryUrl@ diff --git a/maven-wrapper-plugin/src/it/projects/type_script/pom.xml b/maven-wrapper-plugin/src/it/projects/type_script/pom.xml index ed54d55..cbec1de 100644 --- a/maven-wrapper-plugin/src/it/projects/type_script/pom.xml +++ b/maven-wrapper-plugin/src/it/projects/type_script/pom.xml @@ -26,4 +26,41 @@ under the License. <artifactId>extension</artifactId> <version>1.0.0-SNAPSHOT</version> <packaging>pom</packaging> + + <properties> + <cmd></cmd> + </properties> + + <build> + <pluginManagement> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>exec-maven-plugin</artifactId> + <version>3.0.0</version> + <configuration> + <executable>mvnw${cmd}</executable> + <arguments> + <argument>-v</argument> + </arguments> + <environmentVariables> + <MVNW_VERBOSE>true</MVNW_VERBOSE> + </environmentVariables> + </configuration> + </plugin> + </plugins> + </pluginManagement> + </build> + + <profiles> + <profile> + <id>windows</id> + <activation> + <os><family>windows</family></os> + </activation> + <properties> + <cmd>.cmd</cmd> + </properties> + </profile> + </profiles> </project> \ No newline at end of file diff --git a/maven-wrapper-plugin/src/it/projects/type_script/verify.groovy b/maven-wrapper-plugin/src/it/projects/type_script/verify.groovy index 2b6d569..bb18fc5 100644 --- a/maven-wrapper-plugin/src/it/projects/type_script/verify.groovy +++ b/maven-wrapper-plugin/src/it/projects/type_script/verify.groovy @@ -23,10 +23,11 @@ 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 script type wrapper distribution org.apache.maven.wrapper:maven-wrapper-distribution:zip:script:') -assert log.contains('[DEBUG] Using repo URL from MVNW_REPOURL environment variable.') -assert log.contains('[DEBUG] Determined repo URL to use as @localRepositoryUrl@') +// check "mvnw -v" output +assert log.contains("Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ...") +assert new File(basedir,'.mvn/wrapper/maven-wrapper.jar').exists() diff --git a/maven-wrapper-plugin/src/it/projects/type_source/invoker.properties b/maven-wrapper-plugin/src/it/projects/type_source/invoker.properties deleted file mode 100644 index 68fdc5e..0000000 --- a/maven-wrapper-plugin/src/it/projects/type_source/invoker.properties +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -invoker.debug = true -invoker.environmentVariables.MVNW_REPOURL = @localRepositoryUrl@ diff --git a/maven-wrapper-plugin/src/it/projects/type_source/pom.xml b/maven-wrapper-plugin/src/it/projects/type_source/pom.xml index ed54d55..cbec1de 100644 --- a/maven-wrapper-plugin/src/it/projects/type_source/pom.xml +++ b/maven-wrapper-plugin/src/it/projects/type_source/pom.xml @@ -26,4 +26,41 @@ under the License. <artifactId>extension</artifactId> <version>1.0.0-SNAPSHOT</version> <packaging>pom</packaging> + + <properties> + <cmd></cmd> + </properties> + + <build> + <pluginManagement> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>exec-maven-plugin</artifactId> + <version>3.0.0</version> + <configuration> + <executable>mvnw${cmd}</executable> + <arguments> + <argument>-v</argument> + </arguments> + <environmentVariables> + <MVNW_VERBOSE>true</MVNW_VERBOSE> + </environmentVariables> + </configuration> + </plugin> + </plugins> + </pluginManagement> + </build> + + <profiles> + <profile> + <id>windows</id> + <activation> + <os><family>windows</family></os> + </activation> + <properties> + <cmd>.cmd</cmd> + </properties> + </profile> + </profiles> </project> \ No newline at end of file diff --git a/maven-wrapper-plugin/src/it/projects/type_source/verify.groovy b/maven-wrapper-plugin/src/it/projects/type_source/verify.groovy index b17326d..ef5f633 100644 --- a/maven-wrapper-plugin/src/it/projects/type_source/verify.groovy +++ b/maven-wrapper-plugin/src/it/projects/type_source/verify.groovy @@ -24,10 +24,11 @@ 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/MavenWrapperDownloader.java').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 source type wrapper distribution org.apache.maven.wrapper:maven-wrapper-distribution:zip:source:') -assert log.contains('[DEBUG] Using repo URL from MVNW_REPOURL environment variable.') -assert log.contains('[DEBUG] Determined repo URL to use as @localRepositoryUrl@') +// check "mvnw -v" output +assert log.contains("Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ...") +assert new File(basedir,'.mvn/wrapper/maven-wrapper.jar').exists() diff --git a/maven-wrapper-plugin/src/it/settings.xml b/maven-wrapper-plugin/src/it/settings.xml index fef4268..9e1c9fe 100644 --- a/maven-wrapper-plugin/src/it/settings.xml +++ b/maven-wrapper-plugin/src/it/settings.xml @@ -18,31 +18,49 @@ KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> + + <settings> + <mirrors> + <mirror> + <id>mrm-maven-plugin</id> + <name>Mock Repository Manager</name> + <url>@mrm.repository.url@</url> + <mirrorOf>*</mirrorOf> + </mirror> + </mirrors> <profiles> <profile> <id>it-repo</id> <repositories> <repository> - <id>local.central</id> - <url>@localRepositoryUrl@</url> + <id>snapshots</id> + <url>@mrm.repository.url@</url> <releases> <enabled>true</enabled> + <checksumPolicy>ignore</checksumPolicy> + <updatePolicy>never</updatePolicy> </releases> <snapshots> <enabled>true</enabled> + <checksumPolicy>ignore</checksumPolicy> + <updatePolicy>always</updatePolicy> </snapshots> </repository> </repositories> <pluginRepositories> <pluginRepository> - <id>local.central</id> - <url>@localRepositoryUrl@</url> + <id>snapshots</id> + <url>@mrm.repository.url@</url> <releases> <enabled>true</enabled> + <checksumPolicy>ignore</checksumPolicy> + <updatePolicy>never</updatePolicy> </releases> <snapshots> <enabled>true</enabled> + <checksumPolicy>ignore</checksumPolicy> + <updatePolicy>always</updatePolicy> </snapshots> </pluginRepository> </pluginRepositories> 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 825bc37..9f8c8d4 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 @@ -226,7 +226,7 @@ public class WrapperMojo extends AbstractMojo String distributionUrl = repoUrl + "/org/apache/maven/apache-maven/" + mavenVersion + "/apache-maven-" + mavenVersion + "-bin.zip"; String wrapperUrl = repoUrl + "/org/apache/maven/wrapper/maven-wrapper/" + wrapperVersion - + "/maven-wrapper-" + wrapperVersion + ".zip"; + + "/maven-wrapper-" + wrapperVersion + ".jar"; Path wrapperPropertiesFile = targetFolder.resolve( "maven-wrapper.properties" );
