On 20/07/10 3:50 PM, Levi Hoogenberg wrote:
Thanks again, your support is really appreciated. I've modified your example a bit:

[install, uploadArchives].each {task ->
    def taskRepositories = task.repositories.all as List

    if (!taskRepositories.empty) {
addParentScopeMappings(taskRepositories[0].pom.scopeMappings, configurations.compile)
    }
}

private void addParentScopeMappings(def scopeMappings, Configuration configuration) {
    configuration.extendsFrom.each {parentConfiguration ->
        scopeMappings.addMapping(300, parentConfiguration, 'compile')

        addParentScopeMappings(scopeMappings, parentConfiguration)
    }
}

(My uploadArchives task had no repositories.)

Why do we only want to configure the first repository?

We only want to configure the Maven repository. My example assumes that it's the first one, which may not be a good assumption. Strictly speaking, it should find all the repositories of type MavenDeployer and configure them.


--
Adam Murdoch
Gradle Developer
http://www.gradle.org
CTO, Gradle Inc. - Gradle Training, Support, Consulting
http://www.gradle.biz

Reply via email to