Skip to content
This repository was archived by the owner on Jan 19, 2022. It is now read-only.

Commit 1e7418a

Browse files
committed
[MWRAPPER-14] log configured Maven version
1 parent c88160f commit 1e7418a

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

maven-wrapper-plugin/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ under the License.
5252
<artifactId>maven-plugin-api</artifactId>
5353
<version>${mavenVersion}</version>
5454
</dependency>
55+
<dependency>
56+
<groupId>org.apache.maven.shared</groupId>
57+
<artifactId>maven-shared-utils</artifactId>
58+
<version>3.3.4</version>
59+
</dependency>
5560
<dependency>
5661
<groupId>org.apache.maven.shared</groupId>
5762
<artifactId>maven-artifact-transfer</artifactId>

maven-wrapper-plugin/src/main/java/org/apache/maven/plugins/wrapper/WrapperMojo.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@
4747
import org.codehaus.plexus.archiver.UnArchiver;
4848
import org.codehaus.plexus.components.io.fileselectors.FileSelector;
4949

50+
import static org.apache.maven.shared.utils.logging.MessageUtils.buffer;
51+
5052
/**
5153
* Unpacks the maven-wrapper distribution files to the current project source tree.
5254
*
@@ -127,7 +129,8 @@ public void execute() throws MojoExecutionException, MojoFailureException
127129
try
128130
{
129131
unpack( artifact, basedir.toPath() );
130-
getLog().info( "Unpacked " + artifact );
132+
getLog().info( "Unpacked " + buffer().strong( distributionType ) + " type wrapper distribution "
133+
+ artifact );
131134
}
132135
catch ( IOException e )
133136
{
@@ -186,8 +189,15 @@ private void unpack( Artifact artifact, Path targetFolder ) throws IOException
186189
*/
187190
private void replaceProperties( Path targetFolder ) throws IOException
188191
{
192+
String repoUrl = "https://repo.maven.apache.org/maven2";
193+
String distributionUrl =
194+
repoUrl + "/org/apache/maven/apache-maven/" + mavenVersion + "/apache-maven-" + mavenVersion + "-bin.zip";
195+
189196
Path wrapperPropertiesFile = targetFolder.resolve( "maven-wrapper.properties" );
190-
197+
198+
getLog().info( "Configuring .mvn/wrapper/maven-wrapper.properties to use "
199+
+ buffer().strong( "Maven " + mavenVersion ) + " and download from " + repoUrl );
200+
191201
final String license = "# Licensed to the Apache Software Foundation (ASF) under one\n"
192202
+ "# or more contributor license agreements. See the NOTICE file\n"
193203
+ "# distributed with this work for additional information\n"
@@ -208,8 +218,7 @@ private void replaceProperties( Path targetFolder ) throws IOException
208218
try ( BufferedWriter out = Files.newBufferedWriter( wrapperPropertiesFile ) )
209219
{
210220
out.append( license );
211-
out.append( "distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/"
212-
+ mavenVersion + "/apache-maven-" + mavenVersion + "-bin.zip" );
221+
out.append( "distributionUrl=" + distributionUrl );
213222
}
214223
}
215224

0 commit comments

Comments
 (0)