Tomcat 7 下对 JSP 进行预编译

xiaoxiao2021-02-28  95

预编译jsp,直接看maven配置,IDE为idea,注意tomcat的版本,有些版本中有些类是不存在的,那么就把编译的tomcat版本降低

<plugins> <plugin> <groupId>org.codehaus.mojo.jspc</groupId> <artifactId>jspc-maven-plugin</artifactId> <executions> <execution> <goals> <goal>compile</goal> </goals> </execution> </executions> <configuration> <sources> <directory>${basedir}/src/main/webapp</directory> <includes> <include>**/*.jsp</include> </includes> </sources> </configuration> <dependencies> <dependency> <groupId>org.codehaus.mojo.jspc</groupId> <artifactId>jspc-compiler-tomcat6</artifactId> <version>2.0-alpha-3</version> <exclusions> <exclusion> <groupId>org.apache.tomcat</groupId> <artifactId>jasper</artifactId> </exclusion> <exclusion> <groupId>org.apache.tomcat</groupId> <artifactId>jasper-el</artifactId> </exclusion> <exclusion> <groupId>org.apache.tomcat</groupId> <artifactId>jasper-jdt</artifactId> </exclusion> <exclusion> <groupId>org.apache.tomcat</groupId> <artifactId>servlet-api</artifactId> </exclusion> <exclusion> <groupId>org.apache.tomcat</groupId> <artifactId>jsp-api</artifactId> </exclusion> <exclusion> <groupId>org.apache.tomcat</groupId> <artifactId>el-api</artifactId> </exclusion> <exclusion> <groupId>org.apache.tomcat</groupId> <artifactId>annotations-api</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.apache.tomcat</groupId> <artifactId>tomcat-jasper</artifactId> <version>7.0.57</version> </dependency> <dependency> <groupId>org.eclipse.jdt.core.compiler</groupId> <artifactId>ecj</artifactId> <version>4.6.1</version> </dependency> </dependencies> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <configuration> <webXml>${basedir}/target/jspweb.xml</webXml> <warSourceExcludes>jsp/**</warSourceExcludes> </configuration> </plugin> </plugins>
转载请注明原文地址: https://www.6miu.com/read-33830.html

最新回复(0)