Upload dependencies to nexus


(Jan Rodan) #1

Hi together,

I want to upload some special dependencies to our nexus with a simple task. The dependencies are defined in a separate configuration.
See the current state beneath.

How can I get this to work?

Thanks and regards

### subproject x

dependencies {

    compile group: "junit", name: "junit", version: "4.12"

    externalDependencyLibExt group: "junit", name: "junit", version: "4.12"
}

### root
subprojects {

    configurations {
        // define configurations
        externalDependency
        externalDependencyLibExt
        externalDependencyModulesLPKG
        externalDependencyDeploy
    }

    dependencies {
        // I want to wrap all dependencies in one configuration object
        externalDependency configurations.externalDependencyLibExt
        externalDependency configurations.externalDependencyModulesLPKG
        externalDependency configurations.externalDependencyDeploy
    }

    apply plugin: 'maven-publish'
    apply plugin: 'maven'

    artifacts {
        // PROBLEM: this is not working - "No value has been specified for property 'artifacts'."
        configurations.externalDependency
    }

    // upload artifacts from configuration externalDependency
    uploadSomeArtifact {
        group 'publishing'
        repositories {
            mavenDeployer {
                repository(url: deployRepoUrl) {
                    authentication(userName: deployRepoUsername, password: deployRepoPassword)
                }
            }
        }
    }

}