question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Gradle plugin: Duplicated tag: 'dependencyManagement'

See original GitHub issue

For build.gradle, when using

    dependencies {
        constraints {
            compile("com.fasterxml.jackson.core:jackson-databind:${jacksonVersion}") {
                because 'previous versions have security issues'
            }
        }
    }

in combination with

apply plugin: 'io.spring.dependency-management'

dependencyManagement {
    imports {
        mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
    }
}

an invalid POM file is generated with two dependencyManagement elements. Deployment (artifactoryPublish) is thus refused by the artifactory server.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:14
  • Comments:10

github_iconTop GitHub Comments

9reactions
lauraliparulocommented, Apr 2, 2019

I had the same problem.

You don´t need to/cannot use the ‘io.spring.dependency-management’ plugin in the project where you use your bom. so no "dependencymanagement in the build gradle too!

All you need is:

dependencies {

implementation platform('your-bom:version')

//your deps

}

6reactions
piacenticommented, Apr 8, 2020

Had the same problem and just implemented a hack that combines the content of the two dependency management blocks.

task fixPom {
    doLast {
        File file = new File("$buildDir/publications/mavenJava/pom-default.xml")
        def text = file.text
        def pattern = "(?s)(<dependencyManagement>.+?<dependencies>)(.+?)(</dependencies>.+?</dependencyManagement>)"
        Matcher matcher = text =~ pattern
        if (matcher.find()) {
            text = text.replaceFirst(pattern, "")
            def firstDeps = matcher.group(2)
            text = text.replaceFirst(pattern, '$1$2' + firstDeps + '$3')
        }
        file.write(text)
    }
}
generatePomFileForMavenJavaPublication.finalizedBy fixPom
Read more comments on GitHub >

github_iconTop Results From Across the Web

Replicating Maven "dependencyManagement" tag from inside ...
Generally maven dependencyManagement tag is used to import bom or control transitive versions. Gradle does that with platform ...
Read more >
Dependency Management Plugin - Spring
The dependency management plugin improves Gradle's handling of exclusions that have been declared in a Maven pom by honoring Maven's semantics ...
Read more >
io.spring.dependency-management - Gradle Plugin Portal
io.spring.dependency-management. Owner: Spring IO. A Gradle plugin that provides Maven-like dependency management functionality.
Read more >
Gradle plugin: Duplicated tag: 'dependencyManagement' -
Gradle plugin : Duplicated tag: 'dependencyManagement'. JFrogDev. 04 January 2019 Posted by skjolber. For build.gradle, when using
Read more >
spring-gradle-plugins/dependency-management-plugin - Gitter
In Gradle that would mean that you'd declare a dependency without assigning it to a particular configuration and it would, somehow, be assigned...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found