# SourceSet.getClasses() method has been deprecated

**URL:** <https://discuss.gradle.org/t/sourceset-getclasses-method-has-been-deprecated/4423>\
**Category:** Old Forum Archive\
**Created:** [March 13, 2012, 5:34pm UTC](https://discuss.gradle.org/t/sourceset-getclasses-method-has-been-deprecated/4423 "2012-03-13T17:34:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ray\_Tayek](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/ray_tayek/32/4985_2.png) [@Ray\_Tayek](https://discuss.gradle.org/u/Ray_Tayek)\
**Post date:** [March 13, 2012, 5:34pm UTC](https://discuss.gradle.org/t/sourceset-getclasses-method-has-been-deprecated/4423/1 "2012-03-13T17:34:00Z")

</div>

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?

thanks

apply plugin: ‘java’ repositories { mavenCentral() } sourceSets.main.java.srcDirs = [“src”] sourceSets.test.java.srcDirs = [“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) {

archiveName=‘small.jar’

from sourceSets.main.classes

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

}

---

<div class="post-metadata">

**Author:** ![Rene](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/rene/32/8082_2.png) [@Rene](https://discuss.gradle.org/u/Rene)\
**Post date:** [March 13, 2012, 5:51pm UTC](https://discuss.gradle.org/t/sourceset-getclasses-method-has-been-deprecated/4423/2 "2012-03-13T17:51:00Z")

</div>

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

```gradle
from sourceSets.main.classes

```

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

```gradle
from sourceSets.main.output

```

sourceSet.main is of type SourceSet. Have a look at the DSL reference for further information about SourceSet ([http://gradle.org/docs/current/dsl/org.gradle.api.tasks.SourceSet.html](http://gradle.org/docs/current/dsl/org.gradle.api.tasks.SourceSet.html))

---

<div class="post-metadata">

**Author:** ![Ray\_Tayek](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/ray_tayek/32/4985_2.png) [@Ray\_Tayek](https://discuss.gradle.org/u/Ray_Tayek)\
**Post date:** [March 13, 2012, 7:56pm UTC](https://discuss.gradle.org/t/sourceset-getclasses-method-has-been-deprecated/4423/3 "2012-03-13T19:56:00Z")

</div>

from sourceSets.main.output

works like a charm!

thanks
