diff --git a/src/main/groovy/com/bancvue/gradle/maven/publish/DependencyResolver.groovy b/src/main/groovy/com/bancvue/gradle/maven/publish/DependencyResolver.groovy index c6b774b..048884f 100644 --- a/src/main/groovy/com/bancvue/gradle/maven/publish/DependencyResolver.groovy +++ b/src/main/groovy/com/bancvue/gradle/maven/publish/DependencyResolver.groovy @@ -39,7 +39,7 @@ class DependencyResolver { excludeRules.findAll { ExcludeRule excludeRule -> excludeRule.group || excludeRule.module - }.collectAll { ExcludeRule excludeRule -> + }.collect { ExcludeRule excludeRule -> new Exclusion(excludeRule) } } diff --git a/src/main/groovy/com/bancvue/gradle/maven/publish/MavenPublishExtExtension.groovy b/src/main/groovy/com/bancvue/gradle/maven/publish/MavenPublishExtExtension.groovy index 0c71419..cef91f5 100644 --- a/src/main/groovy/com/bancvue/gradle/maven/publish/MavenPublishExtExtension.groovy +++ b/src/main/groovy/com/bancvue/gradle/maven/publish/MavenPublishExtExtension.groovy @@ -242,25 +242,24 @@ class MavenPublishExtExtension { private void attachDependenciesToMavenPublication(ExtendedPublication extendedPublication, MavenPublication mavenPublication) { Set runtimeDependencies = dependencyResolver.getRuntimeDependencies(extendedPublication) - mavenPublication.pom.withXml { - asNode().children().last() + { - dependencies { - runtimeDependencies.each { Dependency aDependency -> - List exclusionList = dependencyResolver.getDependencyExclusions(aDependency) - - dependency { - groupId aDependency.group - artifactId aDependency.name - version aDependency.version - scope "runtime" - - if (exclusionList) { - exclusions { - exclusionList.each { Exclusion item -> - exclusion { - groupId item.groupId - artifactId item.artifactId - } + log.info("Attaching dependencies to maven publication ${mavenPublication.name}") + applyConfigurePomClosureToMavenPublication(mavenPublication) { + dependencies { + runtimeDependencies.each { Dependency aDependency -> + List exclusionList = dependencyResolver.getDependencyExclusions(aDependency) + + dependency { + groupId aDependency.group + artifactId aDependency.name + version aDependency.version + scope "runtime" + + if (exclusionList) { + exclusions { + exclusionList.each { Exclusion item -> + exclusion { + groupId item.groupId + artifactId item.artifactId } } }