This is an old version of the Sling website, see the site conversion page for more info. The migrated but not yet edited version of this page is at /documentation/development/jspc.html
Apache Sling Website > Apache Sling > Documentation > Development > JspC

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 ${} Location of the JSP source file; may be overwritten using the jspc.sourceDirectory system property.
outputDirectory ${}/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.

Last modified by fmeschbe on 2008-02-11 05:47:49.0
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.