4747import org .codehaus .plexus .archiver .UnArchiver ;
4848import 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