Skip to content

Commit ff5cfc1

Browse files
[MPH-185] Restore location format for effective-pom
Was changed by accident in 4f9e3af
1 parent a8bd97c commit ff5cfc1

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/it/projects/effective-pom-verbose/verify.groovy

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,5 @@
2020
String content = new File( basedir, "build.log" ).text
2121

2222
// comments in the same line
23-
assert content.contains( "<groupId>org.apache.maven.its.help</groupId> <!-- " )
23+
assert content.contains( "<groupId>org.apache.maven.its.help</groupId> <!-- org.apache.maven.its.help:test:1.0-SNAPSHOT," )
24+
assert content.contains( "<url>https://maven.apache.org/plugins/test/</url> <!-- org.apache.maven.plugins:maven-plugins:33, line 37 -->" )

src/main/java/org/apache/maven/plugins/help/EffectivePomMojo.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,10 +208,11 @@ private static class InputLocationStringFormatter extends InputLocation.StringFo
208208
public String toString(InputLocation location) {
209209
InputSource source = location.getSource();
210210

211-
String s = source.getLocation(); // by default, display the path
211+
String s = source.getModelId(); // by default, display modelId
212212

213-
if (s == null || s.trim().isEmpty()) {
214-
s = source.getModelId();
213+
if (StringUtils.isBlank(s) || s.contains("[unknown-version]")) {
214+
// unless it is blank or does not provide version information
215+
s = source.toString();
215216
}
216217

217218
return '}' + s + ((location.getLineNumber() >= 0) ? ", line " + location.getLineNumber() : "") + ' ';

0 commit comments

Comments
 (0)