预编译JSP的正确WEB-INF路径是什么?
我的Gradle和Maven构建似乎将预编译的JSP放在不同的包中。Maven版本在预编译JSP的正确WEB-INF路径是什么?,jsp,maven,tomcat,jetty,gradle,Jsp,Maven,Tomcat,Jetty,Gradle,我的Gradle和Maven构建似乎将预编译的JSP放在不同的包中。Maven版本在WEB-INF/classes/jsp/WEB_002dINF中有它们,而Gradle版本在WEB-INF/classes/org/apache/jsp/WEB_002dINF中有它们。两个都好吗 编译后的JSP会在Tomcat和Jetty上使用吗,不管它们是如何构建的 以下是我的构建脚本的相关部分: 马文: <profile> <id>precompileJsps</id&
WEB-INF/classes/jsp/WEB_002dINF
中有它们,而Gradle版本在WEB-INF/classes/org/apache/jsp/WEB_002dINF
中有它们。两个都好吗
编译后的JSP会在Tomcat和Jetty上使用吗,不管它们是如何构建的
以下是我的构建脚本的相关部分:
马文:
<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>
(此问题已从中移开)否。每个容器都有自己的JSP编译器、编译的JSP中使用的内部类以及JSP和类文件之间的映射
您不会得到不同的结果,因为一个构建使用Maven,另一个使用Gradle。您会得到不同的结果,因为一个构建使用Jetty编译器,另一个使用tomcat编译器。否。如果您需要预编译的JSP,则必须创建两个不同的工件。但是容器通常提供在部署时而不是在执行时编译JSP的选项,如果这是困扰您的问题的话。如果目标是在构建时检查JSP是否可编译,那么选择您喜欢的编译器,并放弃结果。谢谢。我一直在寻找一种在部署时编译JSP的方法,但Jetty和Tomcat似乎都没有提供这种方法。
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