91 lines
3.8 KiB
Diff
91 lines
3.8 KiB
Diff
From 0584b0a5bc9aacfec5d668f891b1f8b26748c3c5 Mon Sep 17 00:00:00 2001
|
|
From: Mikolaj Izdebski <mizdebsk@redhat.com>
|
|
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 | 23 ++++++++++++++--------
|
|
.../resolver/impl/depmap/DepmapBasedResolver.java | 2 +-
|
|
2 files changed, 16 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..3537988 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,9 @@ public class DefaultResolver
|
|
@Override
|
|
public ResolutionResult resolve( ResolutionRequest request )
|
|
{
|
|
+ Properties properties = new Properties();
|
|
+ properties.putAll( System.getProperties() );
|
|
+
|
|
// FIXME: bisect is not used
|
|
Artifact artifact = request.getArtifact();
|
|
logger.debug( "Trying to resolve artifact {}", artifact );
|
|
@@ -90,9 +94,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 +132,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
|
|
|