即日起在codingBlog上分享您的技术经验即可获得积分,积分可兑换现金哦。

Tomcat 7 下对 JSP 进行预编译

编程语言 u012294371 18℃ 0评论

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

<plugins>
      <plugin>
          <groupId>org.codehaus.mojo.jspcgroupId>
          <artifactId>jspc-maven-pluginartifactId>
          <executions>
              <execution>
                  <goals>
                      <goal>compilegoal>
                  goals>
              execution>
          executions>
          <configuration>
              <sources>
                  <directory>${basedir}/src/main/webappdirectory>
                  <includes>
                      <include>**/*.jspinclude>
                  includes>
              sources>
          configuration>
          <dependencies>
              <dependency>
                  <groupId>org.codehaus.mojo.jspcgroupId>
                  <artifactId>jspc-compiler-tomcat6artifactId>
                  <version>2.0-alpha-3version>
                  <exclusions>
                      <exclusion>
                          <groupId>org.apache.tomcatgroupId>
                          <artifactId>jasperartifactId>
                      exclusion>
                      <exclusion>
                          <groupId>org.apache.tomcatgroupId>
                          <artifactId>jasper-elartifactId>
                      exclusion>
                      <exclusion>
                          <groupId>org.apache.tomcatgroupId>
                          <artifactId>jasper-jdtartifactId>
                      exclusion>
                      <exclusion>
                          <groupId>org.apache.tomcatgroupId>
                          <artifactId>servlet-apiartifactId>
                      exclusion>
                      <exclusion>
                          <groupId>org.apache.tomcatgroupId>
                          <artifactId>jsp-apiartifactId>
                      exclusion>
                      <exclusion>
                          <groupId>org.apache.tomcatgroupId>
                          <artifactId>el-apiartifactId>
                      exclusion>
                      <exclusion>
                          <groupId>org.apache.tomcatgroupId>
                          <artifactId>annotations-apiartifactId>
                      exclusion>
                  exclusions>
              dependency>

              <dependency>
                  <groupId>org.apache.tomcatgroupId>
                  <artifactId>tomcat-jasperartifactId>
                  <version>7.0.57version>
              dependency>

              <dependency>
                  <groupId>org.eclipse.jdt.core.compilergroupId>
                  <artifactId>ecjartifactId>
                  <version>4.6.1version>
              dependency>
          dependencies>
      plugin>
      <plugin>
          <groupId>org.apache.maven.pluginsgroupId>
          <artifactId>maven-war-pluginartifactId>
          <configuration>
              <webXml>${basedir}/target/jspweb.xmlwebXml>
              <warSourceExcludes>jsp/**warSourceExcludes>
          configuration>
      plugin>
 plugins>

转载请注明:CodingBlog » Tomcat 7 下对 JSP 进行预编译

喜欢 (0)or分享 (0)
发表我的评论
取消评论

*

表情