Like others have proposed before, it would be great if a plugin project could be configured to target a specific version of Gradle while being built using a different version of Gradle.
The use case is plugin builds that use themselves. I’d very much like to break the circular dependency we have with using gradleAPI() and localGroovy() so that our Gradle upgrades become less painful. I thought I’d do some experiments and here is a basic build script that will use Gradle 1.12 but compile against Gradle 2.4.
apply plugin: 'groovy'
repositories {
jcenter()
}
dependencies {
//compile localGroovy()
compile group: 'org.codehaus.groovy', name: 'groovy-all', version: '2.3.10'
//compile gradleApi()
compile group: 'org.gradle', name: 'gradle-core', version: '2.4'
}
task wrapper( type: Wrapper ) {
gradleVersion = '1.12'
}
I haven’t done much testing with this yet but on the surface it seems to do what I want.
I can think of at least two problems that I’ll want to solve:
- During publication, the generated POM will likely not have these gradle and groovy dependency trees excluded. So I’ll have to find a way to do that.
- Given a Gradle version, is there a way I can determine the required Groovy version? I could maintain a hardcoded map, but it would be nice if I didn’t have to.
Does anyone know of any issues with my approach, or other things I’ll need to consider?
Thanks, Chris