SourceSet.getClasses() method has been deprecated

The SourceSet.getClasses() method has been deprecated and will be removed in the

next version of Gradle. Please use the getOutput() method instead. :compileJava UP-TO-DATE

i get the above with my simple script (please see code below).

how can i fix this?


apply plugin: ‘java’ repositories { mavenCentral() } = [“src”] = [“tst”] sourceSets.main.resources.srcDirs = [“src”]

dependencies {

compile fileTree(dir: ‘lib’, includes: [’*.jar’])

testCompile group: ‘junit’,name:‘junit’,version: ‘4.8+’ }

task smallJar(type:Jar) {


from sourceSets.main.classes

include ‘com/tayek/hmr//*’, 'com/tayek/qanda//*’


Hello Ray, the reason for that deprecation warning is this line in your Jar task:

from sourceSets.main.classes

To get rid of this message, you have to use the getOutput() method of source set instead:

from sourceSets.main.output

sourceSet.main is of type SourceSet. Have a look at the DSL reference for further information about SourceSet (

from sourceSets.main.output

works like a charm!