Note that there are some explanatory texts on larger screens.

plurals
  1. POGradle : sourceSets.test.classes not found
    text
    copied!<p>I am trying to get my one of my projects (ProjectA) to generate a jar file containing all the test classes so that it can be used in ProjectB.</p> <p>I did a bit of research and found this as possible solution: <a href="http://mrhaki.blogspot.com/2010/11/gradle-goodness-create-jar-artifact.html" rel="nofollow" title="Create test jar artifact using Gradle">Create test jar artifact in gradle</a>. That says that the following code snippet should do the trick.</p> <pre><code>apply plugin: 'java' task testJar(type: Jar) { classifier = 'tests' from sourceSets.test.classes } </code></pre> <p>However, when I add the above to my <code>build.gradle</code>, I get the following error message:</p> <blockquote> <ul> <li>What went wrong: </li> </ul> <p>A problem occurred evaluating root project 'gradle_project'.</p> <p>Could not find property 'sourceSets' on task ':testJar'.</p> </blockquote> <p>I have searched on both Google and the Gradle documentation for more information but either it has been removed without documenting it anywhere that I could find or I am using it wrong. I am suspecting the latter, just don't know what I am doing wrong.</p> <p>I have tried the same code snippet inside my<code>subprojects{}</code> section but then I got the following error message:</p> <blockquote> <ul> <li>What went wrong:</li> </ul> <p>A problem occurred evaluating root project 'gradle_project'.</p> <p>Cannot get the value of write-only property 'classes' on source set test.</p> </blockquote>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload