Skip to content

Commit 91bdb45

Browse files
[MWRAPPER-143] - The wrapperVersion property is not used in only-script mode (#145)
* [MWRAPPER-143] The wrapperVersion property is not used in only-script mode The only-script mode doesn't use the wrapper distribution, this property is now only added to the maven-wrapper.properties file when other types are used. --------- Co-authored-by: Slawomir Jaranowski <[email protected]>
1 parent 06c9aeb commit 91bdb45

File tree

5 files changed

+10
-6
lines changed

5 files changed

+10
-6
lines changed

maven-wrapper-plugin/src/it/projects/default/verify.groovy

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,6 @@ Properties props = new Properties()
3434
new File(basedir,'.mvn/wrapper/maven-wrapper.properties').withInputStream {
3535
props.load(it)
3636
}
37-
assert props.wrapperVersion.equals(wrapperCurrentVersion)
3837
assert props.distributionType.equals("only-script")
38+
assert !props.containsKey('wrapperUrl')
39+
assert !props.containsKey("wrapperVersion")

maven-wrapper-plugin/src/it/projects/mavenversion/verify.groovy

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,10 @@ Properties props = new Properties()
3030
propertiesFile.withInputStream {
3131
props.load(it)
3232
}
33-
assert props.wrapperVersion.equals(wrapperCurrentVersion)
3433
assert props.distributionUrl.endsWith('/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip')
3534
assert props.distributionType.equals("only-script")
35+
assert !props.containsKey('wrapperUrl')
36+
assert !props.containsKey("wrapperVersion")
3637

3738
log = new File(basedir, 'build.log').text
3839
// check "mvn wrapper:wrapper" output

maven-wrapper-plugin/src/it/projects/sh_type_only-script/verify.groovy

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,7 @@ Properties props = new Properties()
3939
new File(basedir,'.mvn/wrapper/maven-wrapper.properties').withInputStream {
4040
props.load(it)
4141
}
42-
assert props.wrapperVersion.equals(wrapperCurrentVersion)
42+
4343
assert props.distributionType.equals("only-script")
44+
assert !props.containsKey('wrapperUrl')
45+
assert !props.containsKey("wrapperVersion")

maven-wrapper-plugin/src/it/projects/type_only-script/verify.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ assert !(new File(basedir,'mvnwDebug.cmd').exists())
2525

2626
wrapperProperties = new File(basedir,'.mvn/wrapper/maven-wrapper.properties')
2727
assert wrapperProperties.exists()
28-
assert !wrapperProperties.text.contains('wrapperUrl')
2928

3029
log = new File(basedir, 'build.log').text
3130
// check "mvn wrapper:wrapper" output
@@ -39,5 +38,6 @@ Properties props = new Properties()
3938
new File(basedir,'.mvn/wrapper/maven-wrapper.properties').withInputStream {
4039
props.load(it)
4140
}
42-
assert props.wrapperVersion.equals(wrapperCurrentVersion)
4341
assert props.distributionType.equals("only-script")
42+
assert !props.containsKey('wrapperUrl')
43+
assert !props.containsKey("wrapperVersion")

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,14 +326,14 @@ private void replaceProperties(String wrapperVersion, Path targetFolder) throws
326326
+ buffer().strong("Maven " + mavenVersion) + " and download from " + repoUrl);
327327

328328
try (BufferedWriter out = Files.newBufferedWriter(wrapperPropertiesFile, StandardCharsets.UTF_8)) {
329-
out.append("wrapperVersion=" + wrapperVersion + System.lineSeparator());
330329
out.append(DISTRIBUTION_TYPE_PROPERTY_NAME + "=" + distributionType + System.lineSeparator());
331330
out.append("distributionUrl=" + finalDistributionUrl + System.lineSeparator());
332331
if (distributionSha256Sum != null) {
333332
out.append("distributionSha256Sum=" + distributionSha256Sum + System.lineSeparator());
334333
}
335334
if (!distributionType.equals(TYPE_ONLY_SCRIPT)) {
336335
out.append("wrapperUrl=" + wrapperUrl + System.lineSeparator());
336+
out.append("wrapperVersion=" + wrapperVersion + System.lineSeparator());
337337
}
338338
if (wrapperSha256Sum != null) {
339339
out.append("wrapperSha256Sum=" + wrapperSha256Sum + System.lineSeparator());

0 commit comments

Comments
 (0)