From da196b11b015ab8e133226d69d860b9e2d57c0bd Mon Sep 17 00:00:00 2001 From: Christian Schulte Date: Thu, 22 Jun 2017 02:31:30 +0200 Subject: [PATCH] Update debug log messages about management performed (#124) --- .../DefaultPluginDependenciesResolver.java | 21 +++++++------------ .../DefaultProjectDependenciesResolver.java | 10 ++++----- 2 files changed, 11 insertions(+), 20 deletions(-) diff --git a/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginDependenciesResolver.java b/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginDependenciesResolver.java index 8d16c613667..4be7d5ddc1f 100644 --- a/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginDependenciesResolver.java +++ b/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginDependenciesResolver.java @@ -242,15 +242,8 @@ public boolean visitEnter( DependencyNode node ) org.eclipse.aether.artifact.Artifact art = dep.getArtifact(); buffer.append( art ); - if ( StringUtils.isNotEmpty( dep.getScope() ) ) - { - buffer.append( ':' ).append( dep.getScope() ); - } - - if ( dep.isOptional() ) - { - buffer.append( " (optional)" ); - } + buffer.append( ':' ).append( dep.getScope() ); + buffer.append( ':' ).append( dep.isOptional() ? "optional" : "not optional" ); // TODO We currently cannot tell which section contained the management // information. When the resolver provides this information, these log messages should be updated @@ -259,7 +252,7 @@ public boolean visitEnter( DependencyNode node ) { final String premanagedScope = DependencyManagerUtils.getPremanagedScope( node ); buffer.append( " (scope managed from " ); - buffer.append( Objects.toString( premanagedScope, "default" ) ); + buffer.append( StringUtils.defaultString( premanagedScope, "default" ) ); buffer.append( ')' ); } @@ -267,7 +260,7 @@ public boolean visitEnter( DependencyNode node ) { final String premanagedVersion = DependencyManagerUtils.getPremanagedVersion( node ); buffer.append( " (version managed from " ); - buffer.append( Objects.toString( premanagedVersion, "default" ) ); + buffer.append( StringUtils.defaultString( premanagedVersion, "default" ) ); buffer.append( ')' ); } @@ -275,7 +268,7 @@ public boolean visitEnter( DependencyNode node ) { final Boolean premanagedOptional = DependencyManagerUtils.getPremanagedOptional( node ); buffer.append( " (optionality managed from " ); - buffer.append( Objects.toString( premanagedOptional, "default" ) ); + buffer.append( StringUtils.defaultString( premanagedOptional, "default" ) ); buffer.append( ')' ); } @@ -286,7 +279,7 @@ public boolean visitEnter( DependencyNode node ) DependencyManagerUtils.getPremanagedExclusions( node ); buffer.append( " (exclusions managed from " ); - buffer.append( Objects.toString( premanagedExclusions, "default" ) ); + buffer.append( StringUtils.defaultString( premanagedExclusions, "default" ) ); buffer.append( ')' ); } @@ -297,7 +290,7 @@ public boolean visitEnter( DependencyNode node ) DependencyManagerUtils.getPremanagedProperties( node ); buffer.append( " (properties managed from " ); - buffer.append( Objects.toString( premanagedProperties, "default" ) ); + buffer.append( StringUtils.defaultString( premanagedProperties, "default" ) ); buffer.append( ')' ); } } diff --git a/maven-core/src/main/java/org/apache/maven/project/DefaultProjectDependenciesResolver.java b/maven-core/src/main/java/org/apache/maven/project/DefaultProjectDependenciesResolver.java index 7500e43d2a3..25caf17e604 100644 --- a/maven-core/src/main/java/org/apache/maven/project/DefaultProjectDependenciesResolver.java +++ b/maven-core/src/main/java/org/apache/maven/project/DefaultProjectDependenciesResolver.java @@ -253,10 +253,8 @@ public boolean visitEnter( DependencyNode node ) org.eclipse.aether.artifact.Artifact art = dep.getArtifact(); buffer.append( art ); - if ( StringUtils.isNotEmpty( dep.getScope() ) ) - { - buffer.append( ':' ).append( dep.getScope() ); - } + buffer.append( ':' ).append( dep.getScope() ); + buffer.append( ':' ).append( dep.isOptional() ? "optional" : "not optional" ); if ( dep.isOptional() ) { @@ -297,7 +295,7 @@ public boolean visitEnter( DependencyNode node ) DependencyManagerUtils.getPremanagedExclusions( node ); buffer.append( " (exclusions managed from " ); - buffer.append( Objects.toString( premanagedExclusions, "default" ) ); + buffer.append( StringUtils.defaultString( premanagedExclusions, "default" ) ); buffer.append( ')' ); } @@ -308,7 +306,7 @@ public boolean visitEnter( DependencyNode node ) DependencyManagerUtils.getPremanagedProperties( node ); buffer.append( " (properties managed from " ); - buffer.append( Objects.toString( premanagedProperties, "default" ) ); + buffer.append( StringUtils.defaultString( premanagedProperties, "default" ) ); buffer.append( ')' ); } }