Reputation: 16575
My Gradle and Maven builds seems to put precompiled JSPs within different packages. The Maven build have them in WEB-INF/classes/jsp/WEB_002dINF
, while the Gradle build have them in WEB-INF/classes/org/apache/jsp/WEB_002dINF
. Are either fine?
Will the compiled JSPs be used on both Tomcat and Jetty, regardless on how they were built?
Here are the relevant parts of my build scripts:
Maven:
<profile>
<id>precompileJsps</id>
<activation>
<property>
<name>precompileJsps</name>
<value>true</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-jspc-maven-plugin</artifactId>
<version>${version.mortbay.jetty}</version>
<executions>
<execution>
<id>jspc</id>
<goals>
<goal>jspc</goal>
</goals>
<configuration>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
Gradle:
jasper {
compilerSourceVM = "1.7"
compilerTargetVM = "1.7"
outputDir = file("${buildDir}/jasper")
}
task precompileJsps(type: Compile) {
if (System.properties['precompileJsps'] == "true") {
dependsOn tomcatJasper
} else {
enabled = false
}
group = 'build'
description = 'Translates and compiles JSPs'
classpath = configurations.tomcat + sourceSets.main.output + sourceSets.main.runtimeClasspath
sourceCompatibility = jasper.compilerSourceVM
targetCompatibility = jasper.compilerTargetVM
destinationDir = file("$buildDir/classes/main")
source = jasper.outputDir
dependencyCacheDir = file("${buildDir}/dependency-cache")
}
war.dependsOn precompileJsps
(This question was moved from https://stackoverflow.com/questions/19906475/how-do-i-verify-that-precompiled-jsps-are-used-in-tomcat-and-jetty)
Upvotes: 0
Views: 897
Reputation: 691635
No. Each container has its own JSP compiler, internal classes used inside the compiled JSPs, and mapping between JSPs and class files.
You don't get a different result because one build uses Maven and the other one uses Gradle. You get a different result because one build uses the Jetty compiler and the other one uses the tomcat compiler.
Upvotes: 1