When dependency/@conf contains BOTH 'test' and 'compile', and dependency/artifact/@type != 'test', the artifact is NOT a test dependency, to handle solr-morphlines-core's compile-scope cdk-morphlines-core and test-scope cdk-morphlines-core-tests dependencies

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1547479 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Steven Rowe 2013-12-03 17:08:11 +00:00
parent 1f57856b90
commit 0f768189e5
1 changed files with 4 additions and 2 deletions

View File

@ -667,7 +667,7 @@ public class GetMavenDependenciesTask extends Task {
dependencyClassifiers.put(dependencyCoordinate, classifiers); dependencyClassifiers.put(dependencyCoordinate, classifiers);
} }
String conf = dependency.getAttribute("conf"); String conf = dependency.getAttribute("conf");
boolean isTestDependency = conf.contains("test"); boolean confContainsTest = conf.contains("test");
boolean isOptional = optionalExternalDependencies.contains(dependencyCoordinate); boolean isOptional = optionalExternalDependencies.contains(dependencyCoordinate);
SortedSet<ExternalDependency> deps = allExternalDependencies.get(module); SortedSet<ExternalDependency> deps = allExternalDependencies.get(module);
if (null == deps) { if (null == deps) {
@ -683,6 +683,8 @@ public class GetMavenDependenciesTask extends Task {
Element artifact = (Element)artifacts.item(artifactNum); Element artifact = (Element)artifacts.item(artifactNum);
String type = artifact.getAttribute("type"); String type = artifact.getAttribute("type");
String ext = artifact.getAttribute("ext"); String ext = artifact.getAttribute("ext");
// When conf contains BOTH "test" and "compile", and type != "test", this is NOT a test dependency
boolean isTestDependency = confContainsTest && (type.equals("test") || ! conf.contains("compile"));
if ((type.isEmpty() && ext.isEmpty()) || type.equals("jar") || ext.equals("jar")) { if ((type.isEmpty() && ext.isEmpty()) || type.equals("jar") || ext.equals("jar")) {
String classifier = artifact.getAttribute("maven:classifier"); String classifier = artifact.getAttribute("maven:classifier");
if (classifier.isEmpty()) { if (classifier.isEmpty()) {
@ -696,7 +698,7 @@ public class GetMavenDependenciesTask extends Task {
} }
} else { } else {
classifiers.add(null); classifiers.add(null);
deps.add(new ExternalDependency(groupId, artifactId, null, isTestDependency, isOptional)); deps.add(new ExternalDependency(groupId, artifactId, null, confContainsTest, isOptional));
} }
} }
} }