47
47
import org .codehaus .plexus .archiver .UnArchiver ;
48
48
import org .codehaus .plexus .components .io .fileselectors .FileSelector ;
49
49
50
+ import static org .apache .maven .shared .utils .logging .MessageUtils .buffer ;
51
+
50
52
/**
51
53
* Unpacks the maven-wrapper distribution files to the current project source tree.
52
54
*
@@ -127,7 +129,8 @@ public void execute() throws MojoExecutionException, MojoFailureException
127
129
try
128
130
{
129
131
unpack ( artifact , basedir .toPath () );
130
- getLog ().info ( "Unpacked " + artifact );
132
+ getLog ().info ( "Unpacked " + buffer ().strong ( distributionType ) + " type wrapper distribution "
133
+ + artifact );
131
134
}
132
135
catch ( IOException e )
133
136
{
@@ -186,8 +189,15 @@ private void unpack( Artifact artifact, Path targetFolder ) throws IOException
186
189
*/
187
190
private void replaceProperties ( Path targetFolder ) throws IOException
188
191
{
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
+
189
196
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
+
191
201
final String license = "# Licensed to the Apache Software Foundation (ASF) under one\n "
192
202
+ "# or more contributor license agreements. See the NOTICE file\n "
193
203
+ "# distributed with this work for additional information\n "
@@ -208,8 +218,7 @@ private void replaceProperties( Path targetFolder ) throws IOException
208
218
try ( BufferedWriter out = Files .newBufferedWriter ( wrapperPropertiesFile ) )
209
219
{
210
220
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 );
213
222
}
214
223
}
215
224
0 commit comments