im trying to change our build process from Maven to Gradle (V 2.9). In Maven, I used precompilation for JSP as follows:
<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>
and it worked fine. Now I'm trying to find a way to do the same with gradle. I found some examples of /build.gradle, but nothing works. Im currently using Tomcat 7 as a servlet container, and I plan to switch in a few weeks to 8. It would be ideal, of course, to compile them for the target servlet container, but first of all I would be happy to copy them first, as if I did it with maven for / with a pier.
Part of my current build.gradle that gives me an error:
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}" }
Im getting the following error:
: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.
Running this jsp in Tomcat 7 works fine ... Does anyone have an updated guide or tooltip?
source share