I have a multi-project build and have an artifactory repo setup. I’m trying the set the classpath on a taskdef during the configuration phase. This is needed of an existing ant build that I’m trying to import. If I simply redefine the repository in the subproject, or if I access the configuration in a task (execution phase), it works fine. Any ideas on how I can get this to work without having to redefine my repository?
This is the error I get:
Could not resolve all dependencies for configuration … Could not find org.apache.ant:ant-junit:1.9.2.
I’ve included an example in the most simplest form possible:
parentDir/settings.gradle:
include 'test'
parentDir/build.gradle:
buildscript {
repositories {
maven {
url 'myurl/artifactory/plugins-release'
}
}
dependencies {
classpath(group: 'org.jfrog.buildinfo', name: 'build-info-extractor-gradle', version: '2.0.9')
}
}
allprojects {
apply plugin: 'artifactory'
defaultTasks 'build'
}
artifactory {
contextUrl = "myurl/artifactory"
//The base Artifactory URL if not overridden by the publisher/resolver
resolve {
repository {
repoKey = 'libs-release'
maven = true
}
}
}
parentDir/test/build.gradle:
// the following block works fixes the problem
/*repositories {
maven {
url 'http://myurl/artifactory/plugins-release'
}
}*/
configurations {
junitAnt
}
dependencies {
junitAnt 'org.apache.ant:ant-junit:1.9.2','org.apache.ant:ant-junit4:1.9.2'
}
println configurations.junitAnt.asPath //breaks during configuration phase
task(build) << {
//println configurations.junitAnt.asPath // this line works if uncommented and comment out previous println
}