I have an additional java source in my assembly called gen- as in generated sources with a lot of compiler warnings in them. The task gradle eclipseconfigures the source directory of this set as the source eclipse folder, which leads to a lot of warnings that I don't want to see. Another reason is that the generated source code should not change - I do not want anyone to edit it randomly, thinking that this is regular code.
The following steps are performed, but only when overwriting an existing configuration with gradle eclipse.
eclipse.classpath.file {
whenMerged { classpath ->
classpath.entries.removeAll {
entry -> entry.kind == 'src' && entry.path == 'src/gen/java'
}
}
}
However, this does not work if clearing the configuration is gradle cleanEclipse eclipsewhat happens when you first import the project into eclipse.
Reading the documentation for the EclipseClasspath object , I believe that the only way is to use it eclipse.classpath.file.withXml, but it's too dirty to edit raw xml.
Is there an even more elegant solution?
jmruc source
share