You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by eo...@apache.org on 2018/12/11 11:31:32 UTC

[maven-enforcer] 01/01: [MENFORCER-323] - Improve output of "Some plugins are missing valid versions" error

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

eolivelli pushed a commit to branch MENFORCER-323
in repository https://gitbox.apache.org/repos/asf/maven-enforcer.git

commit 94c97d58751810fcf057898433ebe6f4f2bb4c39
Author: Josh Soref <js...@users.noreply.github.com>
AuthorDate: Mon Dec 10 14:39:20 2018 -0500

    [MENFORCER-323] - Improve output of "Some plugins are missing valid versions" error
    
    The old output could be:
    ```
    Some plugins are missing valid versions:(LATEST RELEASE SNAPSHOT are not allowed )
    org.apache.maven.plugins:maven-release-plugin. The version currently in use is 2.5.3
    org.apache.maven.plugins:maven-resources-plugin. The version currently in use is 3.0.2
    ```
    
    If that if branch wasn't taken, then there wouldn't even be a newline, which would make the output even uglier.
---
 .../org/apache/maven/plugins/enforcer/RequirePluginVersions.java   | 7 ++++---
 .../src/it/projects/require-plugin-versions-ci/verify.groovy       | 2 +-
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequirePluginVersions.java b/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequirePluginVersions.java
index f3df358..b63af6e 100644
--- a/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequirePluginVersions.java
+++ b/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequirePluginVersions.java
@@ -265,7 +265,7 @@ public class RequirePluginVersions
                 newMsg.append( "Some plugins are missing valid versions:" );
                 if ( banLatest || banRelease || banSnapshots || banTimestamps )
                 {
-                    newMsg.append( "(" );
+                    newMsg.append( " (" );
                     if ( banLatest )
                     {
                         newMsg.append( "LATEST " );
@@ -278,8 +278,9 @@ public class RequirePluginVersions
                     {
                         newMsg.append( "SNAPSHOT " );
                     }
-                    newMsg.append( "are not allowed )\n" );
+                    newMsg.append( "are not allowed)" );
                 }
+                newMsg.append( "\n" );
                 for ( Plugin plugin : failures )
                 {
                     newMsg.append( plugin.getGroupId() );
@@ -1262,4 +1263,4 @@ public class RequirePluginVersions
     {
         return additionalPlugins;
     }
-}
\ No newline at end of file
+}
diff --git a/maven-enforcer-plugin/src/it/projects/require-plugin-versions-ci/verify.groovy b/maven-enforcer-plugin/src/it/projects/require-plugin-versions-ci/verify.groovy
index 865bfeb..d098917 100644
--- a/maven-enforcer-plugin/src/it/projects/require-plugin-versions-ci/verify.groovy
+++ b/maven-enforcer-plugin/src/it/projects/require-plugin-versions-ci/verify.groovy
@@ -18,4 +18,4 @@
  */
 File buildLog = new File( basedir, 'build.log' )
 assert buildLog.text.contains( '[WARNING] Rule 0: org.apache.maven.plugins.enforcer.RequirePluginVersions failed with message:' )
-assert buildLog.text.contains( 'Some plugins are missing valid versions:(LATEST RELEASE SNAPSHOT are not allowed )' )
+assert buildLog.text.contains( 'Some plugins are missing valid versions: (LATEST RELEASE SNAPSHOT are not allowed)' )