Last Updated: February 25, 2016
·
3.189K
· koendewaele

gradle build: fixing groovy.lang.GroovyRuntimeException: Cannot get the value of write-only property 'classes' on source set main

As per documentation, this should work in a gradle build:

task packageJar(type: Jar) {
from sourceSets.main.classes
}

But if you run it, you get probably an error in Gradle 1.2.

Instead, try this:

task packageJar(type: Jar) {
from sourceSets.main.output
}

And everything should work just fine.