In my android library project I use com.github.dcendents:android-maven-gradle-plugin:1.5
to install my library to my local maven repo, and this has always worked fine. Now, for various NDK related reasons I have had to switch to the gradle-experimental-0.8.2 plugin. This version of the gradle plugin uses a new syntax, with e.g. model
blocks surrounding the android
blocks.
The problem is, when using this new syntax I am unable to get my maven artifact tasks to work, for example the sourcesJar
task that is taken straight from the examples:
task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}
This no longer works because there is no block android
. I assumed I simply had to change to the new syntax, such as model.android.sources.main.java.source.srcDirs
, but with no luck. In fact, it says could not get unknown property 'android' for task 'lib:model' of type org.gradle.api.reporting.model.ModelReport
.
I also have simpler statements such as
version = android.defaultConfig.versionName
This also doesn't work neither with android.defaultConfig
nor model.android.defaultConfig
.
What am I doing wrong here? It feels like I have misunderstood how gradle/groovy works fundamentally when I am unable to reference variables defined in blocks like I used to do with the stable gradle version. I thought the android
block was simply moved one level of indirection down, inside model
blocks, so why can't I reference things like model.android.defaultConfig.versionName
?