我的 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>
<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