I have run into some problems with the TestNG dependency resolving.
TestNG comes in two flavours jdk15 and jdk14 to use this with the
flatDirResolver you would expect to put the following in your build file:
dependencies {
addFlatDirResolver('lib',new File(rootDir, 'lib')) // uses
[artifact](-[revision])(-[classifier]).[ext]
testCompile "testng:testng:5.8:jd...@jar"
}
lib dir contents:
lib/testng-5.8-jdk15.jar
I expected this to work but it doesn't Ivy didn't try any filename with the
artifact classifier.
I ended up doing the folowing:
dependencies {
File libDir = new File(rootDir, '../lib')
addFlatDirResolver('lib',libDir).addArtifactPattern(new
File(libDir.absolutePath,
'[artifact]-[revision]-[conf].[ext]').absolutePath)
clientModule(['testCompile'],'testng:testng:5.8:jdk15') {
Artifact testngArtifact = new Artifact('testng','jar','jar',null,
null)
testngArtifact.setConfs(['jdk15'])
addArtifact(testngArtifact)
}
}
I checked our source and the classifier is passed to Ivy as extra
attributes, but it doesn't get picked up. I don't know the [classifier]
pattern element yet can somebody explain this element? is this the same as
[conf]? or should it get mapped to [conf]? Has anybody else run into this?
Also in order to prevent the integration tests from downloading testng a
couple of times I'm using a FlatDirResolver in the tests.
So I wanted to add both testng-5.8-jdk14 and testng-5.8-jdk to the gradle
build (so that they only need to get downloaded once) and resolve and copy
them into the correct directory.
So I added "org.testng:testng:5.8:jd...@jar",
"org.testng:testng:5.8:jd...@jar" to distLib but only the one that you put
last is actually resolved.
Current solution:
clientModule(['testngIntegrationTesting'],'testng:testng:5.8') {
addArtifact(new Artifact('testng','jar','jar','jdk15', "
http://repo2.maven.org/maven2/org/testng/testng/5.8/testng-5.8-jdk15.jar"))
addArtifact(new Artifact('testng','jar','jar','jdk14', "
http://repo2.maven.org/maven2/org/testng/testng/5.8/testng-5.8-jdk14.jar"))
}
testngIntegrationTesting "org.codehaus.groovy:groovy-all:1.5.6"
and put the files from the testIntegrationTesting configuration in the
src/samples/testng/lib directory before the exploded dist directory is
created.
Haven't gotten a chance to look at this but I'm just letting you know about
the hack in the build file.