When using the following configuration (build.gradle)
plugins {
id "org.xbib.gradle.plugin.jflex" version "1.7.0"
}
repositories {
mavenCentral()
}
tasks.named('generateJflex').configure {
// write output into custom location .
target = file("${project.buildDir}/generated/sources/jflexCustom/")
}
the JFlex java source file is generated into ${project.buildDir}/generated/sources/jflexCustom/ as expected
but it is not compiled by the compileJava task, which actually looks into ${project.buildDir}/generated/sources/main/.
When using the following configuration (build.gradle)
plugins {
id "org.xbib.gradle.plugin.jflex" version "1.7.0"
}
repositories {
mavenCentral()
}
tasks.named('generateJflex').configure {
// enable legacy behavior of writing directly into Java source directory
writeIntoJavaSrc = true
}
the JFlex java source file is generated into ${project.buildDir}/generated/sources/main/ instead of src/main/java/.
So the writeIntoJavaSrc flag specified for the generateJflex task is not taken into account as I would expect it to be.
Expected behavior
Example1: the java compiler should compile the java file produced by the JFlexTask.
Example 2: the java file produced by the JFlexTask should written in the Java source directory.
Problem description
If you configure
JFlexTask
directly (not using the jflex extension) this can lead to unexpected behavior.Example 1 (see stalb/JFlex_Example3)
When using the following configuration (
build.gradle
)the JFlex java source file is generated into
${project.buildDir}/generated/sources/jflexCustom/
as expected but it is not compiled by thecompileJava
task, which actually looks into${project.buildDir}/generated/sources/main/
.Example 2 (see stalb/JFlex_Example4)
When using the following configuration (
build.gradle
)the JFlex java source file is generated into
${project.buildDir}/generated/sources/main/
instead ofsrc/main/java/
. So thewriteIntoJavaSrc
flag specified for thegenerateJflex
task is not taken into account as I would expect it to be.Expected behavior
Example1: the java compiler should compile the java file produced by the JFlexTask.
Example 2: the java file produced by the JFlexTask should written in the Java source directory.