Setting the Resource Folder in a Java Gradle project
<p>I am trying to set up a Gradle Java project, but for some reason I can't seem to register the resources folder with the build. Whenever I try to write to a file, it writes to the project root and not the resources folder.</p>

<p>My project directory is as follows:</p>

<ul>
<li>src

<ul>
<li>main

<ul>
<li>java</li>
<li>resources</li>
</ul></li>
</ul></li>
</ul>

<p>Here is my build.gradle file</p>

<pre><code>apply plugin: 'java'
apply plugin: 'application'

repositories {
        mavenCentral()
}

mainClassName='Test'


sourceSets {
        main {
                java {
                        srcDirs= ["src/main/java"]
                }
                resources {
                        srcDirs= ["src/main/resources"]
                }
        }
}
</code></pre>

<p>And here is my Test.java that I'm using to see if I can access the resources folder</p>

<pre><code>import java.io.*;

public class Test {

        public static void main(String[] args) throws Exception {

                FileWriter writer = new FileWriter(new File("Test.txt"));
                writer.write("Test");
                writer.close();

        }

}
</code></pre>