Home » Documentation » Development
This page is a translated version of /site/jspc.html. In case of doubt you might want to refer to the old page.

Maven JspC Plugin

The Maven JspC Plugin provides a single goal jspc which is by default executed in the compile phase of the Maven build process. This goal takes all JSP source files from a configured location (src/main/scripts by default) and compiles them into classes in a configurable location (target/jspc-plugin-generated by default). In addition, for each compiled JSP a Declarative Services descriptor is generated and written to a descriptor file (OSGI-INF/jspServiceComponents.xml in the output location). This descriptor will then be read by the Service Component Runtime of the deployment OSGi framework to register all contained JSP as javax.servlet.Servlet services.


To use the Maven JspC Plugin define the following elements in the <plugins> section of the POM:

<?xml version="1.0" encoding="ISO-8859-1"?>


The Maven JspC Plugin may be configured in the <configuration> element using the following properties:

Parameter Default Value Description
sourceDirectory $\{project.build.scriptSourceDirectory} Location of the JSP source file; may be overwritten using the jspc.sourceDirectory system property.
outputDirectory $\{project.build.directory}/jspc-plugin-generated Target directory for the compiled JSP classes; may be overwritten using the jspc.outputDirectory system propertiy.
compilerTargetVM 1.5 The Target Virtual Machine Version to generate class files for; may be overwritten using the jspc.compilerTargetVM system property.
compilerSourceVM 1.5 The Compiler Source Version of the Java source generated from the JSP files before compiling into classes; may be overwritten using the jspc.compilerSourceVM system property.
servletPackage org.apache.jsp The root package name for the generated class files; may be overwritten using the jspc.servletPackage system property.


The generated JSP classes as well as the Declarative Services descriptor are automatically copied to the generated bundle jar file if the Maven Bundle Plugin (from the Apache Felix) project is used to build the project package.

Rev. 1499238 by fmeschbe on Wed, 3 Jul 2013 07:39:54 +0000
Apache Sling, Sling, Apache, the Apache feather logo, and the Apache Sling project logo are trademarks of The Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their respective owners.