JSPC Maven Plugin

Maven JSP precompilation plugin

License

License

Categories

Categories

Maven Build Tools Jakarta Server Pages Jakarta EE The Web Tier
GroupId

GroupId

io.leonard.maven.plugins
ArtifactId

ArtifactId

jspc-maven-plugin
Last Version

Last Version

4.0.0
Release Date

Release Date

Type

Type

maven-plugin
Description

Description

JSPC Maven Plugin
Maven JSP precompilation plugin
Project URL

Project URL

https://github.com/leonardehrenfried/jspc-maven-plugin#readme
Source Code Management

Source Code Management

https://github.com/leonardehrenfried/jspc-maven-plugin

Download jspc-maven-plugin

How to add to project

<plugin>
    <groupId>io.leonard.maven.plugins</groupId>
    <artifactId>jspc-maven-plugin</artifactId>
    <version>4.0.0</version>
</plugin>

Dependencies

compile (7)

Group / Artifact Type Version
org.apache.tomcat : tomcat-jasper jar 10.0.0
org.eclipse.jdt.core.compiler : ecj jar 4.6.1
org.apache.ant : ant jar 1.10.9
org.apache.maven : maven-plugin-api jar 3.6.3
org.apache.maven : maven-core jar 3.6.3
org.apache.maven.plugin-tools : maven-plugin-annotations jar 3.6.0
javax.servlet : javax.servlet-api jar 4.0.1

test (6)

Group / Artifact Type Version
org.apache.maven.plugin-testing : maven-plugin-testing-harness jar 3.3.0
org.apache.maven : maven-compat jar 3.6.3
org.apache.maven : maven-model jar 3.6.3
junit : junit jar 4.13.1
org.assertj : assertj-core jar 2.8.0
org.glassfish.web : jakarta.servlet.jsp.jstl jar 2.0.0

Project Modules

There are no modules declared in this project.

JSPC Maven Plugin

Build Status Maven Central

This plugin precompiles JSPs. It is a fork of jetty-jspc-maven-plugin and configured as follows:

<build>
....
<plugin>
 <groupId>io.leonard.maven.plugins</groupId>
  <artifactId>jspc-maven-plugin</artifactId>
  <version>${ENTER_VERSION_HERE}</version>
   <executions>
    <execution>
     <id>jspc</id>
     <goals>
     <goal>compile</goal>
    </goals>
    <configuration>
    </configuration>
  </execution>
 </executions>
</plugin>
...
</build>

It has the following improvements compared to jetty-jspc-maven-plugin:

  • Faster: can be configured to run multi-threaded. For a speed comparison read the blog post below.
  • More descriptive error messages: Under Maven 3 this plugin shows a clear indication of what caused the error and which file it is in
  • Not stop at the first error (depends plugin configuration)

The compiler used by default in this plugin is Apache Jasper 9.0.17.

If the Jasper compiler version needs to be overloaded, the plugin must be configured as follows:

<build>
  ....
  <plugin>
    <groupId>io.leonard.maven.plugins</groupId>
    <artifactId>jspc-maven-plugin</artifactId>
    <version>${ENTER_VERSION_HERE}</version>
    <executions>
      <execution>
        <id>jspc</id>
        <goals>
          <goal>compile</goal>
        </goals>
        <configuration />
      </execution>
    </executions>
    <dependencies>
      <dependency>
        <groupId>org.apache.tomcat</groupId>
        <artifactId>tomcat-jasper</artifactId>
        <version>${ENTER_JASPER_VERSION_HERE}</version>
        <exclusions>
          <exclusion>
            <groupId>org.eclipse.jdt.core.compiler</groupId>
            <artifactId>ecj</artifactId>
          </exclusion>
        </exclusions>
      </dependency>
      <dependency>
        <groupId>org.eclipse.jdt.core.compiler</groupId>
        <artifactId>ecj</artifactId>
        <version>4.6.1</version>
      </dependency>
    </dependencies>
  </plugin>
  ...
</build>

Full documentation of the goal is available at http://leonardehrenfried.github.com/jspc-maven-plugin/compile-mojo.html

Compatibility Matrix

  • 4.X version of jspc-maven-plugin : needs Java >= 1.8, Jasper only 10.X
  • 3.X version of jspc-maven-plugin : needs Java >= 1.8, Jasper only 9.X
  • 2.X version of jspc-maven-plugin : needs Java >= 1.7, Jasper only 8.X
  • 1.X version of jspc-maven-plugin : needs Java >= 1.5, Jasper only 6.X, 7.X

Comparison of precompiler plugins

https://tcollignon.github.io/2016/12/04/How-to-compile-JSP-with-Tomcat-and-Maven-faster.html

Use another JSP compiler

By default this plugin use org.apache.jasper.compiler.JDTCompiler (see compilerClass goal option). But if the number of threads is over 2, this compiler has too much synchronization overheas and hence is no very not very performant.

To improve this is possible to user another compilerClass org.apache.jasper.compiler.ParallelJDTCompiler, which reduces synchronization.

Note : With Tomcat 9 the compiler org.apache.jasper.compiler.ParallelJDTCompiler will not work very well. It needs some fix. We advice to use the standard org.apache.jasper.compiler.JDTCompiler instead.

Release process

  1. make release
  2. make commit-site

Versions

Version
4.0.0
3.2.0
3.1.1
3.1.0
3.0.0
3.0.0-RC5
3.0.0-RC4
3.0.0-RC3
3.0.0-RC2
3.0.0-RC1
2.4.6
2.4.5
2.4.4
2.4.3
2.4.2
2.4.1
2.3.0
2.2.0
2.1.0
2.0.0