Even when the properties for sourceCompatibility
and targetCompatibility
are set to a specific JRE Version, will the classpathentry for the JRE_CONTAINER
only be genarated as <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER" exported="true"/>
, and the default JRE-Version under "Installed JREs" in the eclipse settings doesn't always match the JRE-Version I want to use within my project.
How can I ask gradle, to set the JRE_CONTAINER to a specific version when gradle is run with gradle eclipse
?
apply plugin: 'java'
apply plugin: 'eclipse'
ext {
target = "1.5"
}
def jreContainer = 'org.eclipse.jdt.launching.JRE_CONTAINER'
if (target == '1.4' || target == '1.5') {
jreContainer += '/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-' + target
} else if (target == '1.6' || target == '1.7') {
jreContainer += '/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-' + target
}
eclipse {
classpath {
containers.clear()
containers.add(jreContainer)
}
}
in my case it work well like below
containers.add('org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk6')
but 'jdk6' is user specific name
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With