I want to change the output location to separate the test classes from my other classes.
I used the code provided in the Buildship 1.0.18 release notes (https://discuss.gradle.org/t/buildship-1-0-18-is-now-available/19012 ):
apply plugin: 'java'
apply plugin: 'eclipse'
eclipse {
classpath {
file {
whenMerged {
def src = entries.find { it.path == 'src/main/java' }
src.output = "/$eclipse.project.name/classes/main-java"
}
}
}
}
Note: I don’t use Buildship; I only use the eclipse task to generate my eclipse project.
All works as expected, but when I run the eclipse task a second time, a duplicate (and invalid) classpathEntry is created:
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry path="bin" kind="output"/>
<classpathentry output="/gradleSrcFolderOutput/classes/main-java" kind="src" path="src/main/java"/>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/>
</classpath>
Am I doing something wrong?