Hello again!
I've another question regarding th JspC plugin: I build a very simple web
app based on the webapp archetype and want to precompile the JSPs with the
plugin. I want to use tag libraries like JSTL. I tried to compile a sample
JSP with the following content:
<%@ page language="java" contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html>
<body>
<h2>Hello World!</h2>
</body>
</html>
When I call the JspC plugin, the following error occurs:
[INFO] [jspc:compile {execution: jspc}]
[INFO] jspc args: [-uriroot, V:\Development\testWebapp/src/main/webapp,
-d, V:\Development\testWebapp/target/jsp-source, -s, -l, -webinc,
V:\Development\testWebapp/target/web-fragment.xml, -p, jsp]
[INFO] V:\Development\testWebapp\target\classes
[INFO] D:\Dokumente und
Einstellungen\Andi\.m2\repository\tomcat\jasper-runtime\5.5.12\jasper-runtime-5.5.12.jar
[INFO] D:\Dokumente und
Einstellungen\Andi\.m2\repository\tomcat\jasper-compiler\5.5.12\jasper-compiler-5.5.12.jar
[INFO] D:\Dokumente und
Einstellungen\Andi\.m2\repository\taglibs\standard\1.1.2\standard-1.1.2.jar
[INFO] D:\Dokumente und
Einstellungen\Andi\.m2\repository\javax\servlet\jstl\1.1.2\jstl-1.1.2.jar
org.apache.jasper.JasperException: The absolute uri:
http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or
the jar files deployed with this application
My pom.xml looks like this:
<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.webapp</groupId>
<artifactId>testWebapp</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>Maven Webapp Archetype</name>
<url>http://maven.apache.org</url>
<build>
<finalName>testWebapp</finalName>
<plugins>
<!-- use Java 5 compiler settings -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<!-- precompile JSPs -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jspc-maven-plugin</artifactId>
<version>1.2</version>
<executions>
<execution>
<id>jspc</id>
<phase>generate-sources</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<!-- Servlet 2.4 / JSP 2.0 APIs -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jsp-api</artifactId>
<version>2.0</version>
<scope>provided</scope>
</dependency>
<!-- JSTL implementation -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.2</version>
</dependency>
<!-- Jasper for compiling the JSPs -->
<dependency>
<groupId>tomcat</groupId>
<artifactId>jasper-compiler</artifactId>
<version>5.5.12</version>
</dependency>
<dependency>
<groupId>tomcat</groupId>
<artifactId>jasper-runtime</artifactId>
<version>5.5.12</version>
</dependency>
</dependencies>
</project>
The web.xml looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="test" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<!-- [INSERT FRAGMENT HERE] -->
<display-name>Archetype Created Web Application</display-name>
</web-app>
As standard.jar contains the file c.tld in the META-INF directory with the
tag library definition for the specified URI, the library should be
present in the classpath
Thanks,
Andi