This is an automated email from the ASF dual-hosted git repository.

sjaranowski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-help-plugin.git


The following commit(s) were added to refs/heads/master by this push:
     new ff5cfc1  [MPH-185] Restore location format for effective-pom
ff5cfc1 is described below

commit ff5cfc1585345f40aedbda56c0ec2a2fafac7cfc
Author: Slawomir Jaranowski <s.jaranow...@gmail.com>
AuthorDate: Sat Mar 11 09:01:53 2023 +0100

    [MPH-185] Restore location format for effective-pom
    
    Was changed by accident in 4f9e3af9fa8fd632c19453cc994da4981e3a5e2b
---
 src/it/projects/effective-pom-verbose/verify.groovy               | 3 ++-
 src/main/java/org/apache/maven/plugins/help/EffectivePomMojo.java | 7 ++++---
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/it/projects/effective-pom-verbose/verify.groovy 
b/src/it/projects/effective-pom-verbose/verify.groovy
index 6364c14..71c44d5 100644
--- a/src/it/projects/effective-pom-verbose/verify.groovy
+++ b/src/it/projects/effective-pom-verbose/verify.groovy
@@ -20,4 +20,5 @@
 String content = new File( basedir, "build.log" ).text
 
 // comments in the same line
-assert content.contains( "<groupId>org.apache.maven.its.help</groupId>  <!-- " 
)
+assert content.contains( "<groupId>org.apache.maven.its.help</groupId>  <!-- 
org.apache.maven.its.help:test:1.0-SNAPSHOT," )
+assert content.contains( "<url>https://maven.apache.org/plugins/test/</url>  
<!-- org.apache.maven.plugins:maven-plugins:33, line 37 -->" )
diff --git a/src/main/java/org/apache/maven/plugins/help/EffectivePomMojo.java 
b/src/main/java/org/apache/maven/plugins/help/EffectivePomMojo.java
index 2b321e4..921da5d 100644
--- a/src/main/java/org/apache/maven/plugins/help/EffectivePomMojo.java
+++ b/src/main/java/org/apache/maven/plugins/help/EffectivePomMojo.java
@@ -208,10 +208,11 @@ public class EffectivePomMojo extends 
AbstractEffectiveMojo {
         public String toString(InputLocation location) {
             InputSource source = location.getSource();
 
-            String s = source.getLocation(); // by default, display the path
+            String s = source.getModelId(); // by default, display modelId
 
-            if (s == null || s.trim().isEmpty()) {
-                s = source.getModelId();
+            if (StringUtils.isBlank(s) || s.contains("[unknown-version]")) {
+                // unless it is blank or does not provide version information
+                s = source.toString();
             }
 
             return '}' + s + ((location.getLineNumber() >= 0) ? ", line " + 
location.getLineNumber() : "") + ' ';

Reply via email to