From 8c8e33889c90383343144b7c29042d2b8dd63400 Mon Sep 17 00:00:00 2001 From: jaymode Date: Thu, 21 Apr 2016 07:52:00 -0400 Subject: [PATCH] build: remove test dependencies from published pom file See elastic/elasticsearch#2063 Original commit: elastic/x-pack-elasticsearch@3653368363e861b3474b1343f695f0e479ad9f8e --- elasticsearch/x-pack/build.gradle | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/elasticsearch/x-pack/build.gradle b/elasticsearch/x-pack/build.gradle index 970169a404c..e64aac614c9 100644 --- a/elasticsearch/x-pack/build.gradle +++ b/elasticsearch/x-pack/build.gradle @@ -187,13 +187,17 @@ modifyPom { MavenPom pom -> // find the 'base' dependency and replace it with the correct name because the project name is // always used even when the pom of the other project is correct - for (Node depNode : depsNodes.get(0).children()) { + Iterator childNodeIter = depsNodes.get(0).children().iterator() + while (childNodeIter.hasNext()) { + Node depNode = childNodeIter.next() String groupId = depNode.get('groupId').get(0).text() Node artifactIdNode = depNode.get('artifactId').get(0) String artifactId = artifactIdNode.text() + String scope = depNode.get("scope").get(0).text() if (groupId.equals('org.elasticsearch') && artifactId.equals('base')) { artifactIdNode.replaceNode(new Node(null, 'artifactId', 'license-core')) - return + } else if ('test'.equals(scope)) { + childNodeIter.remove() } } }