gradle-tomcat-plugin icon indicating copy to clipboard operation
gradle-tomcat-plugin copied to clipboard

Documentation - add example to compile translated jsps

Open freshcodemonger opened this issue 5 years ago • 1 comments

The plugin defaults to translate jsps into java files but not compile those jsps for war file packaging. The tomcatJasper task is dependent on classes. Since classes runs first, your existing .java files will be turned into .class files, then your jsps will be turned into .java files. This is the correct ordering as your .class files may be required to translate or compile your jsp / jsp java files.

The problem is that you can't make tomcatJasper finalized by compileJava because it depends on classes which causes a circular dependency and won't work in gradle.

The solution I eventually came up with is:

task compileJspJava(type: JavaCompile)  {
	  source = 'build/jasper'
	  classpath = compileJava.classpath
	  destinationDir = compileJava.destinationDir
}

tomcatJasper.finalizedBy compileJspJava

I believe this is what most people are wanting

freshcodemonger avatar Jan 10 '20 01:01 freshcodemonger

If you allow me to create a new branch then I'll create a PR for this documentation.

freshcodemonger avatar Jan 13 '20 00:01 freshcodemonger