Gradle - Add folder to Eclipse classpath
gradle, gradle-eclipse
Solution
Given the limitations of Gradle's `EclipseClasspath` API, the most straightforward solution I can think of is to declare `src/main/conf` as another source directory:
sourceSets.main.java.srcDir "src/main/conf"
As long as the directory doesn't contain any Java files, this won't affect the outcome of the Gradle build. However, the directory will show up as a source directory in Eclipse, and its properties files will therefore be copied into the Eclipse output directory.
Problem
I am migrating a legacy application from Ant to Gradle. The requirement is to build a zip file with a certain folder structure which is used by the deployment team. I am able to create the zip file in the correct format, so-far-so-good. I am able to open the project in Eclipse, but cannot run it. In Eclipse (and IntelliJ) I need `src/main/conf` to be added to Eclipse's classpath, but not be included in the JAR (e.g. if I were to run `gradle jar`). This is how the project is currently structured: ``` src /main /java /com /example /App.java /resources /applicationConfiguration.xml /conf /dev.properties /staging.properties /prod.properties ``` How can I add the `conf` folder to Eclipse's classpath so that it is not included in the JAR that Gradle creates?