gpt4 book ai didi

jsp - 预编译 JSP 的正确 WEB-INF 路径是什么?

转载 作者:行者123 更新时间:2023-11-28 23:00:24 25 4
gpt4 key购买 nike

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

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

(这个问题是从 https://stackoverflow.com/questions/19906475/how-do-i-verify-that-precompiled-jsps-are-used-in-tomcat-and-jetty 移过来的)

最佳答案

没有。每个容器都有自己的 JSP 编译器、编译后的 JSP 内部使用的内部类,以及 JSP 和类文件之间的映射。

您不会得到不同的结果,因为一个构建使用 Maven 而另一个使用 Gradle。您会得到不同的结果,因为一个构建使用 Jetty 编译器而另一个构建使用 tomcat 编译器。

关于jsp - 预编译 JSP 的正确 WEB-INF 路径是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19907297/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com