My Gradle和Maven构建似乎将预编译的JSP放在不同的包中。 Maven构建将它们放在WEB-INF/classes/jsp/WEB_002dINF
中,而Gradle构建将它们放在WEB-INF/classes/org/apache/jsp/WEB_002dINF
中。要么罚款吗?
编译的JSP是否可以在Tomcat和Jetty上使用,无论它们是如何构建的?
以下是我的构建脚本的相关部分:
的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>
摇篮:
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
答案 0 :(得分:1)
没有。每个容器都有自己的JSP编译器,在编译的JSP中使用的内部类,以及JSP和类文件之间的映射。
您没有得到不同的结果,因为一个构建使用Maven而另一个构建使用Gradle。您得到的结果不同,因为一个构建使用Jetty编译器而另一个构建使用tomcat编译器。