At around 1:06 in this video is this gradle script to download from Artifactory:
configurations {
war
}
dependencies {
war "$project.group:$project.name:$project.version"
}
task downloadBinaryArchive(type: Copy) {
from configurations.war
into "$buildDir/download"
}
When I run this I get:
A problem occurred evaluating root project 'the_project'.
> Could not find method war() for arguments [the_group:the_project:1.0] on root project 'the_project'.
I have that code in my main build.gradle script that includes the war plugin.
I get the impression that the example above (which I can find no issues with) is slightly different than how it is arranged in your actual build script. Are you perhaps trying to declare the configuration after the dependency?
No, the order I’ve written is what I have. If I remove the configuration part I still receive the same error - like the configuration isn’t being picked up.
I’ve gone back to basics. I created a new WEB Spring Starter project and inserted those same lines. There is NO LOCATION i can insert those lines that doesn’t give me that same error. Can you see what is wrong with this simple example?:
When I changed the configuration name from war to ANYTHING ELSE (except say resources and possibly other reserved words) it worked as expected. So this worked:
repositories {
maven { url "${artifactory_contextUrl}/libs-release-local" }
mavenCentral()
}
configurations {
downloadWar
}
dependencies {
downloadWar(group: 'the_group', name: 'the_name', version: '1.0')
// OR this of course
downloadWar('the_group:the_name:1.0')
}
task downloadBinaryArchive(type: Copy) {
from configurations.downloadWar
into "$buildDir/download"
}
NOTE that I needed to choose an artifact that exists in the artifactory repository or else I received an error about could not resolve all dependencies.
Now the question is, why does war configuration work for Peter N but not for I? I tried Gradle 2.3, 2.4 and 2.5.