From f428fae1edfc860ed2bcabf920f3cba14a5a9ef5 Mon Sep 17 00:00:00 2001 From: Mikolaj Izdebski Date: Fri, 30 May 2014 06:52:05 +0200 Subject: [PATCH 2/3] Respect xmvn.resolver.disableEffectivePom property XMvn can't distinguish between two cases: there are no dependencies in metadata and dependencies weren't generated. A property saying that dependencies were omitted is added so that XMvn won't generate effective POMs for artfacts with no dependencies in metadata. --- .../xmvn/resolver/impl/DefaultResolver.java | 22 ++++++++++++++-------- .../resolver/impl/depmap/DepmapBasedResolver.java | 2 +- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/xmvn-core/src/main/java/org/fedoraproject/xmvn/resolver/impl/DefaultResolver.java b/xmvn-core/src/main/java/org/fedoraproject/xmvn/resolver/impl/DefaultResolver.java index 9572dc6..8c55ebe 100644 --- a/xmvn-core/src/main/java/org/fedoraproject/xmvn/resolver/impl/DefaultResolver.java +++ b/xmvn-core/src/main/java/org/fedoraproject/xmvn/resolver/impl/DefaultResolver.java @@ -18,6 +18,7 @@ package org.fedoraproject.xmvn.resolver.impl; import java.io.IOException; import java.nio.file.Path; import java.nio.file.Paths; +import java.util.Properties; import javax.inject.Inject; import javax.inject.Named; @@ -73,6 +74,8 @@ public class DefaultResolver @Override public ResolutionResult resolve( ResolutionRequest request ) { + Properties properties = System.getProperties(); + // FIXME: bisect is not used Artifact artifact = request.getArtifact(); logger.debug( "Trying to resolve artifact {}", artifact ); @@ -90,9 +93,15 @@ public class DefaultResolver compatVersion = artifact.getVersion(); } + if ( metadata != null ) + { + properties.putAll( metadata.getProperties() ); + } + if ( metadata != null + && !StringUtils.equals( properties.getProperty( "xmvn.resolver.disableEffectivePom" ), "true" ) && StringUtils.equals( metadata.getExtension(), "pom" ) - && ( !StringUtils.equals( metadata.getProperties().getProperty( "type" ), "pom" ) || metadata.getPath() == null ) ) + && ( !StringUtils.equals( properties.getProperty( "type" ), "pom" ) || metadata.getPath() == null ) ) { try { @@ -122,15 +131,12 @@ public class DefaultResolver } // TODO: drop support for depmaps - if ( System.getProperty( "xmvn.depmap.ignore" ) != null ) + if ( properties.getProperty( "xmvn.resolver.disableDepmap" ) == null ) { - logger.debug( "Failed to resolve artifact: {}", artifact ); - return new DefaultResolutionResult(); - } - else - { - // TODO: drop support for depmaps return depmapResolver.resolve( request ); } + + logger.debug( "Failed to resolve artifact: {}", artifact ); + return new DefaultResolutionResult(); } } diff --git a/xmvn-core/src/main/java/org/fedoraproject/xmvn/resolver/impl/depmap/DepmapBasedResolver.java b/xmvn-core/src/main/java/org/fedoraproject/xmvn/resolver/impl/depmap/DepmapBasedResolver.java index 7571146..298b060 100644 --- a/xmvn-core/src/main/java/org/fedoraproject/xmvn/resolver/impl/depmap/DepmapBasedResolver.java +++ b/xmvn-core/src/main/java/org/fedoraproject/xmvn/resolver/impl/depmap/DepmapBasedResolver.java @@ -228,7 +228,7 @@ public class DepmapBasedResolver if ( result == null ) { - logger.info( "Failed to resolve artifact: {}", artifact ); + logger.debug( "Failed to resolve artifact: {}", artifact ); return new DefaultResolutionResult(); } -- 1.9.0