Modification of pom through mavenDeployer removes dependencies

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Modification of pom through mavenDeployer removes dependencies

Xavier Ducrohet
We're getting reports from our user that the new version of our plugin is broken when doing something like this:

uploadArchives {
    repositories {
        mavenDeployer {
            repository(url: "...")
            pom.groupId = "changeMe"
        }
    }
}

Any modification of the POM through the deployer makes it not contain the dependencies for the artifact. This happens with Gradle 1.10 and 1.11

The one thing we changed in the plugin is going from doing a single:

       project.plugins.withType(MavenPlugin) {
            project.conf2ScopeMappings.addMapping(300,
                    project.configurations[name],
                    "compile")
        }

to calling this many times (for different Configurations).

This is because each variant's dependencies comes from a set of Configuration objects instead of a single one. We used to only use the main Configuration object and it was wrong.

We have a composite Configuration that extends from all of the Configuration that make up the variant (directly or indirectly), and we call getExtendsFrom() on it (and on all the results) to find all the Configuration object that configure out dependency.

Then we call the snippet above on all the Configurations that were found.

This is the only change we did in our new plugin. I'm not sure how this can have an impact on using the pom DSL object or not.

I'm not sure where to start looking. Does anyone have any idea?

thanks!
Xav
Reply | Threaded
Open this post in threaded view
|

Re: Modification of pom through mavenDeployer removes dependencies

Luke Daley-2


On 15 March 2014 at 7:42:04 am, Xavier Ducrohet ([hidden email]) wrote:

We're getting reports from our user that the new version of our plugin is broken when doing something like this:

uploadArchives {
    repositories {
        mavenDeployer {
            repository(url: "...")
            pom.groupId = "changeMe"
        }
    }
}

Any modification of the POM through the deployer makes it not contain the dependencies for the artifact. This happens with Gradle 1.10 and 1.11

The one thing we changed in the plugin is going from doing a single:

       project.plugins.withType(MavenPlugin) {
            project.conf2ScopeMappings.addMapping(300,
                    project.configurations[name],
                    "compile")
        }

to calling this many times (for different Configurations).

This is because each variant's dependencies comes from a set of Configuration objects instead of a single one. We used to only use the main Configuration object and it was wrong.

We have a composite Configuration that extends from all of the Configuration that make up the variant (directly or indirectly), and we call getExtendsFrom() on it (and on all the results) to find all the Configuration object that configure out dependency.

Then we call the snippet above on all the Configurations that were found.

This is the only change we did in our new plugin. I'm not sure how this can have an impact on using the pom DSL object or not.

I'm not sure where to start looking. Does anyone have any idea?

I don’t unfortunately.

If you can give me concrete steps to reproduce, I’ll look into it as a priority.