How do I precompile my JSTL jsps?
Author: Deron Eriksson
Description: This tutorial describes how to precompile your JSTL JSPs using the maven jspc plugin.
Tutorial created using: Windows Vista || JDK 1.6.0_04 || Eclipse Web Tools Platform 2.0.1 (Eclipse 3.3.1) || Tomcat 6.0.14


Page: < 1 2

(Continued from page 1)

My updated pom.xml file for my "mywebapp" project is shown here:

pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>com.maventest</groupId>
	<artifactId>mywebapp</artifactId>
	<packaging>war</packaging>
	<version>1.0-SNAPSHOT</version>
	<name>mywebapp Maven Webapp</name>
	<url>http://maven.apache.org</url>
	<dependencies>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>3.8.1</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>servlet-api</artifactId>
			<version>2.5</version>
			<scope>provided</scope>
		</dependency>
		<!-- begin - jstl dependency-->
		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>jstl</artifactId>
			<version>1.1.2</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>taglibs</groupId>
			<artifactId>standard</artifactId>
			<version>1.1.2</version>
			<scope>provided</scope>
		</dependency>
		<!-- end - jstl dependency-->
	</dependencies>
	<build>
		<finalName>mywebapp</finalName>
		<plugins>
			<!-- begin - precompiling jsps -->
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>jspc-maven-plugin</artifactId>
				<executions>
					<execution>
						<id>jspc</id>
						<goals>
							<goal>compile</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-war-plugin</artifactId>
				<configuration>
					<webXml>${basedir}/target/jspweb.xml</webXml>
				</configuration>
			</plugin>
			<!-- end - precompiling jsps -->
			<!-- begin - deploying/undeploying to Tomcat -->
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>tomcat-maven-plugin</artifactId>
				<configuration>
					<url>http://192.168.1.7:8080/manager</url>
					<server>mytomcat</server>
					<path>/mywebapp</path>
				</configuration>
			</plugin>
			<!-- end - deploying/undeploying to Tomcat -->
			<!-- begin - compiling project to a particular version of java -->
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<configuration>
					<source>1.6</source>
					<target>1.6</target>
				</configuration>
			</plugin>
			<!-- end - compiling project to a particular version of java -->
			<!-- begin - setting classpath to use an Eclipse user library for Tomcat (for eclipse:eclipse) -->
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-eclipse-plugin</artifactId>
				<inherited>true</inherited>
				<configuration>
					<classpathContainers>
						<classpathContainer>org.eclipse.jdt.launching.JRE_CONTAINER</classpathContainer>
						<classpathContainer>org.eclipse.jdt.USER_LIBRARY/TOMCAT_6.0.14_LIBRARY</classpathContainer>
					</classpathContainers>
				</configuration>
			</plugin>
			<!-- end - setting classpath to use an Eclipse user library for Tomcat (for eclipse:eclipse) -->
		</plugins>
	</build>
</project>
Page: < 1 2