Hi
I’m new to gradle so likely I have mist something obvious.
This is my gradle script:
apply plugin: 'java'
apply plugin: 'eclipse'
jar {
baseName = 'sample-project'
version =
'0.1.0'
}
repositories {
maven {
url 'http://127.0.0.1:9081/artifactory/repo'
}
}
dependencies {
compile group: 'org.hibernate', name: 'hibernate-core', version: '4.1.8.Final'
testRuntime group: 'junit', name: 'junit', version: '4.5'
testRuntime group: 'info.cukes', name: 'cucumber-java', version: '1.1.8'
testRuntime group: 'info.cukes', name: 'cucumber-junit', version: '1.1.8'
}
sourceSets {
main {
java {
srcDir 'src'
srcDir 'test'
}
resources {
srcDir 'src'
}
}
}
When I run the eclipse task all dependecies are download and I can use build my project in eclipse… really nice feature by the way
Here comes the problem:
When I run the build task from the commandline it seem like all my test dependencies can not be located.
I’m running this on windows by the way.
Any hints?
David_Karr
(davidmichaelkarr)
August 11, 2014, 3:07pm
2
I think it’s likely that you need to change “testRuntime” to “testCompile”. Those dependencies are needed at compile time.
Also, are you certain that your dependencies are available in your local Artifactory repo?
Hi
I tried change it to “testCompile” … no change… stil can build
If i look in the dependencies cache folder I can see that for several dependencies only the pom file has been download even thought the jar is available.
This is both the case for junit and cucumber-jvm.
This explains why it will not build… but why are they not downloaded?
David_Karr
(davidmichaelkarr)
August 11, 2014, 5:19pm
4
It might help if you ran your build with “–info” or even “–debug”. That might provide more information, and it might be useful to post the relevant part of that here, if you don’t get enough clues from viewing that output yourself.
If I switch them all to ‘compile’ aka:
dependencies {
compile group: 'org.hibernate', name: 'hibernate-core', version: '4.1.8.Final'
compile group: 'org.xerial', name: 'sqlite-jdbc', version: '3.7.2'
compile group: 'junit', name: 'junit', version: '4.5'
compile group: 'info.cukes', name: 'cucumber-java', version: '1.1.8'
compile group: 'info.cukes', name: 'cucumber-junit', version: '1.1.8'
}
Then it works.
This is naturally nice… but I fell like I’m missing a point about these configurations.
erdi
(Marcin Erdmann)
August 12, 2014, 10:54am
6
If you change your source sets definition to:
sourceSets {
main {
java {
srcDir 'src'
}
}
test {
java {
srcDir 'test'
}
}
}
And add your test dependencies to testCompile configuration then it will work.
Great… that seems to work. Thank you.