Maven deployer adding dependency on spock


(Tim Dudgeon) #1

I’m using the Maven deployer and its mostly working OK, but I’m getting an unexpected dependency on the spock library which is only part of the testCompile configuration. Can someone spot what is wrong? The key parts of my build.gradle are:

configurations {

deployerJars

}

dependencies {

groovy “org.codehaus.groovy:groovy-all:1.8.6”

testCompile “org.spockframework:spock-core:0.6-groovy-1.8”

compile fileTree(dir: ‘libs/dp’, includes: [’*.jar’])

deployerJars “org.apache.maven.wagon:wagon-ssh:1.0-beta-2”

}

uploadArchives {

repositories.mavenDeployer {

name = ‘sshDeployer’ // optional

configuration = configurations.deployerJars

repository(url: “scp://somewhere.com/maven-repo”) {

authentication(userName: mavenRepositoryUsername, password: mavenRepositoryPassword)

}

}

}

and when the archives are uploaded my pom file contains a dependency to spock.

org.spockframework

spock-core

0.6-groovy-1.8

test

I don’t understand this as I thought only things in the runtime configuration should become dependencies?


(Peter Niederwieser) #2

This works as designed. By default, Gradle will map the ‘compile’, ‘runtime’, and ‘testCompile/testRuntime’ configurations to Maven’s ‘compile’, ‘runtime’, and ‘test’ scopes, respectively. This mapping can be customized. See Dependency mapping in the user guide.


(Tim Dudgeon) #3

Hi Peter, thanks for clarifying this. So in my case I need just the runtime configuration. I looked at the link you gave and can’t work this out. Do you have an example you could provide? Thanks Tim