maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From micha...@apache.org
Subject [06/28] maven git commit: [MNG-6183] Dependency management debug message corrections.
Date Sat, 01 Apr 2017 22:21:34 GMT
[MNG-6183] Dependency management debug message corrections.


Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/aaae0b25
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/aaae0b25
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/aaae0b25

Branch: refs/heads/MNG-6169
Commit: aaae0b25a7bc9ad0ebebdcb017fa70f5a605d4c8
Parents: f48c9f9
Author: Christian Schulte <schulte@apache.org>
Authored: Tue Mar 14 19:20:47 2017 +0100
Committer: Michael Osipov <michaelo@apache.org>
Committed: Sun Apr 2 00:21:12 2017 +0200

----------------------------------------------------------------------
 .../DefaultProjectDependenciesResolver.java     | 83 ++++++++------------
 1 file changed, 31 insertions(+), 52 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/aaae0b25/maven-core/src/main/java/org/apache/maven/project/DefaultProjectDependenciesResolver.java
----------------------------------------------------------------------
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 21dfaa2..5a803af 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
@@ -29,8 +29,6 @@ import org.apache.maven.artifact.Artifact;
 import org.apache.maven.model.Dependency;
 import org.apache.maven.model.DependencyManagement;
 import org.apache.maven.model.Exclusion;
-import org.apache.maven.model.InputLocation;
-import org.apache.maven.model.InputSource;
 import org.codehaus.plexus.component.annotations.Component;
 import org.codehaus.plexus.component.annotations.Requirement;
 import org.codehaus.plexus.logging.Logger;
@@ -39,7 +37,6 @@ import org.eclipse.aether.DefaultRepositorySystemSession;
 import org.eclipse.aether.RepositorySystem;
 import org.eclipse.aether.RepositorySystemSession;
 import org.eclipse.aether.RequestTrace;
-import org.eclipse.aether.artifact.ArtifactProperties;
 import org.eclipse.aether.artifact.ArtifactType;
 import org.eclipse.aether.artifact.ArtifactTypeRegistry;
 import org.eclipse.aether.collection.CollectRequest;
@@ -239,8 +236,6 @@ public class DefaultProjectDependenciesResolver
 
         private String indent = "";
 
-        private Map<String, Dependency> managed;
-
         public GraphLogger( MavenProject project )
         {
             this.project = project;
@@ -258,29 +253,48 @@ public class DefaultProjectDependenciesResolver
                 buffer.append( art );
                 buffer.append( ':' ).append( dep.getScope() );
 
-                String premanagedScope = DependencyManagerUtils.getPremanagedScope( node
);
-                if ( premanagedScope != null && !premanagedScope.equals( dep.getScope()
) )
+                // TODO We currently cannot tell which <dependencyManagement> section
contained the management
+                //      information. When resolver 1.1 provides this information, these log
messages should be updated
+                //      to contain it.
+                if ( ( node.getManagedBits() & DependencyNode.MANAGED_SCOPE ) == DependencyNode.MANAGED_SCOPE
)
                 {
-                    buffer.append( " (scope managed from " ).append( premanagedScope );
-                    appendManagementSource( buffer, art, "scope" );
+                    final String premanagedScope = DependencyManagerUtils.getPremanagedScope(
node );
+                    buffer.append( " (scope managed from " );
+                    buffer.append( StringUtils.defaultString( premanagedScope, "default"
) );
                     buffer.append( ')' );
                 }
 
-                String premanagedVersion = DependencyManagerUtils.getPremanagedVersion( node
);
-                if ( premanagedVersion != null && !premanagedVersion.equals( art.getVersion()
) )
+                if ( ( node.getManagedBits() & DependencyNode.MANAGED_VERSION ) == DependencyNode.MANAGED_VERSION
)
                 {
-                    buffer.append( " (version managed from " ).append( premanagedVersion
);
-                    appendManagementSource( buffer, art, "version" );
+                    final String premanagedVersion = DependencyManagerUtils.getPremanagedVersion(
node );
+                    buffer.append( " (version managed from " );
+                    buffer.append( StringUtils.defaultString( premanagedVersion, "default"
) );
                     buffer.append( ')' );
                 }
 
-                Boolean premanagedOptional = DependencyManagerUtils.getPremanagedOptional(
node );
-                if ( premanagedOptional != null && !premanagedOptional.equals( dep.getOptional()
) )
+                if ( ( node.getManagedBits() & DependencyNode.MANAGED_OPTIONAL ) == DependencyNode.MANAGED_OPTIONAL
)
                 {
-                    buffer.append( " (optionality managed from " ).append( premanagedOptional
);
-                    appendManagementSource( buffer, art, "optional" );
+                    final Boolean premanagedOptional = DependencyManagerUtils.getPremanagedOptional(
node );
+                    buffer.append( " (optionality managed from " );
+                    buffer.append( StringUtils.defaultString( premanagedOptional, "default"
) );
                     buffer.append( ')' );
                 }
+
+                if ( ( node.getManagedBits() & DependencyNode.MANAGED_EXCLUSIONS )
+                        == DependencyNode.MANAGED_EXCLUSIONS )
+                {
+                    // TODO As of resolver 1.1, use DependencyManagerUtils.getPremanagedExclusions(
node ).
+                    //      The resolver 1.0.x releases do not record premanaged state of
exclusions.
+                    buffer.append( " (exclusions managed)" );
+                }
+
+                if ( ( node.getManagedBits() & DependencyNode.MANAGED_PROPERTIES )
+                        == DependencyNode.MANAGED_PROPERTIES )
+                {
+                    // TODO As of resolver 1.1, use DependencyManagerUtils.getPremanagedProperties(
node ).
+                    //      The resolver 1.0.x releases do not record premanaged state of
properties.
+                    buffer.append( " (properties managed)" );
+                }
             }
             else
             {
@@ -301,41 +315,6 @@ public class DefaultProjectDependenciesResolver
             return true;
         }
 
-        private void appendManagementSource( StringBuilder buffer, org.eclipse.aether.artifact.Artifact
artifact,
-                                             String field )
-        {
-            if ( managed == null )
-            {
-                managed = new HashMap<>();
-                if ( project.getDependencyManagement() != null )
-                {
-                    for ( Dependency dep : project.getDependencyManagement().getDependencies()
)
-                    {
-                        managed.put( dep.getManagementKey(), dep );
-                    }
-                }
-            }
-
-            String key =
-                ArtifactIdUtils.toVersionlessId( artifact.getGroupId(), artifact.getArtifactId(),
-                                                artifact.getProperty( ArtifactProperties.TYPE,
"jar" ),
-                                                artifact.getClassifier() );
-
-            Dependency dependency = managed.get( key );
-            if ( dependency != null )
-            {
-                InputLocation location = dependency.getLocation( field );
-                if ( location != null )
-                {
-                    InputSource source = location.getSource();
-                    if ( source != null )
-                    {
-                        buffer.append( " by " ).append( source.getModelId() );
-                    }
-                }
-            }
-        }
-
     }
 
 }


Mime
View raw message