plugins {
id 'java'
id "org.xbib.gradle.plugin.jflex" version "1.7.0" apply false
}
repositories {
mavenCentral()
}
def copyJava = tasks.register("copyJava", Copy) {
from 'src/main/custom/'
into "${project.buildDir}/generated/sources/custom/java/testJFlex"
}
sourceSets {
main {
java {
srcDir copyJava
}
}
}
apply plugin: "org.xbib.gradle.plugin.jflex"
The main Java SourceDirectorySet should contains copyJava output and generateJflex output,
However when gradle-plugin-jflex plugin is applied after the main Java SourceDirectorySet configuration,
the output of copyJava disappears from the SourceDirectorySet.
In fact, since the output of the copyJava task is not in the main java SourceDirectorySet anymore, it will not be even considered as a dependency of compileJava.
So running ./gradlew compileJava will not trigger the copyJava task which output will not be compiled.
If plugins which modify the java SourceDirectorySet are applied before gradle-plugin-jflex plugin, their modifications can also be overwritten.
Expected behavior:
gradle-plugin-jflex plugin should not overwrite SourceDirectorySet additions made by plugins or tasks applied previously.
In the example, running the compileJava task should trigger both generateJflex and copyJava tasks
and all their Java outputs should be compiled by compileJava.
Problem:
Sometime the
gradle-plugin-jflex
overwrites modifications made by plugins or tasks (applied beforegradle-plugin-jflex
plugin).An example can be found in stalb/JFlex_Example:
The main Java SourceDirectorySet should contains
copyJava
output andgenerateJflex
output, However whengradle-plugin-jflex
plugin is applied after the main Java SourceDirectorySet configuration, the output ofcopyJava
disappears from the SourceDirectorySet.In fact, since the output of the
copyJava
task is not in the main java SourceDirectorySet anymore, it will not be even considered as a dependency ofcompileJava
. So running./gradlew compileJava
will not trigger thecopyJava
task which output will not be compiled.If plugins which modify the java SourceDirectorySet are applied before
gradle-plugin-jflex
plugin, their modifications can also be overwritten.Expected behavior:
gradle-plugin-jflex
plugin should not overwrite SourceDirectorySet additions made by plugins or tasks applied previously.In the example, running the
compileJava
task should trigger bothgenerateJflex
andcopyJava
tasks and all their Java outputs should be compiled bycompileJava
.