私のビルドプロセスをMavenからGradle(V 2.9)に変更しようとしています。 Mavenでは、次のようにJSPのプリコンパイルを使用していました。GradleでJSPをプリコンパイル
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-jspc-maven-plugin</artifactId>
<version>9.2.7.v20150116</version>
<executions>
<execution>
<phase>package</phase>
<id>jspc</id>
<goals>
<goal>jspc</goal>
</goals>
<configuration>
<excludes>**\/*inc_page_bottom.jsp,**\/*inc_page_top.jsp</excludes>
<includes>**\/*.jsp</includes>
</configuration>
</execution>
</executions>
</plugin>
これはうまくいきました。 今、私はgradleで同じことをする方法を見つけようとしています。 私はいくつかの情報/ build.gradleの例を見つけましたが、実際には何も動作していませんでした。私は現在サーブレットコンテナとしてTomcat 7を使用していますが、8週間に数週間で切り替える予定です。ターゲットサーブレットコンテナ用にそれらをコンパイルするのはもちろん完璧でしょうが、まず最初にこれを実行したようにプリコンパイルすることになります桟橋と一緒に/桟橋で。
私にエラーを与える私の現在のbuild.gradleの一部:次のエラーを取得
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.bmuschko:gradle-tomcat-plugin:2.2.4'
}
}
apply plugin: 'com.bmuschko.tomcat'
tomcat {
jasper {
validateXml = true
errorOnUseBeanInvalidClassAttribute = false
compilerSourceVM = "1.8"
compilerTargetVM = "1.8"
}
}
task compileJsps(type: JavaCompile, dependsOn: 'clean') {
dependsOn tomcatJasper
group = 'build'
description = 'Translates and compiles JSPs'
classpath = configurations.tomcat + sourceSets.main.output + sourceSets.main.runtimeClasspath
sourceCompatibility = "1.8"
targetCompatibility = "1.8"
destinationDir = file("$buildDir/jasper-classes")
sourceSets {
main {
java {
srcDir "$buildDir/jasper"
}
}
}
}
dependencies {
def tomcatVersion = '7.0.59'
tomcat "org.apache.tomcat.embed:tomcat-embed-core:${tomcatVersion}",
"org.apache.tomcat.embed:tomcat-embed-logging-juli:${tomcatVersion}",
"org.apache.tomcat.embed:tomcat-embed-jasper:${tomcatVersion}"
}
イム:Tomcatの7でこのJSPの実行
:tomcatJasper FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':tomcatJasper'.
> org.apache.jasper.JasperException: file:/xxx/xxx/xxx/xxx/src/main/webapp/index.jsp (line: 6, column: 0) The value for the useBean class attribute xxx.xxx.xxx.XxxXxx is invalid.
が正常に動作します... 誰かが最新のハウツーやヒントを持っていますか?
この回答をお持ちですか? <%@ include file = "directives.jsp"%>はサーバー上で動作しますが、プリコンパイルのコンテキストでは動作しませんでした –
残念ながら、何も解決しませんでした。 – StephanM
私たちは、桟橋のjdt-coreの隆起を助けて、jre 18u112と互換性のあるジャスパーコンパイラを手に入れました –