使用maven2的jetty插件预编译JSP2009-07-17 15:22使用maven2的jetty插件预编译JSP
参考文章
http://docs.codehaus.org/display/JETTY/Maven+Jetty+Jspc+Plugin
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.wgame</groupId>
<artifactId>ln3</artifactId>
<packaging>war</packaging>
<name>ln3</name>
<version>1.0</version>
<build>
<finalName>ln3</finalName>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webappDirectory>
${basedir}/web
</webappDirectory>
<warSourceDirectory>
${basedir}/web
</warSourceDirectory>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<profiles>
<profile>
<id>prod</id>
<activation>
<property><name>prod</name></property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-jspc-plugin</artifactId>
<version>6.1.16</version>
<executions>
<execution>
<id>jspc</id>
<goals>
<goal>jspc</goal>
</goals>
<configuration>
<webAppSourceDirectory>
${basedir}/web
</webAppSourceDirectory>
<generatedClasses>
${basedir}/target/jspc
</generatedClasses>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webappDirectory>
${basedir}/web
</webappDirectory>
<warSourceDirectory>
${basedir}/web
</warSourceDirectory>
<webXml>
${basedir}/web/WEB-INF/web.xml
</webXml>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<dependencies>
</dependencies>
</project>
配置了POM.XML后运行命令:
mvn -Dprod package
就将JSP编译好放置在target/jspc目录下了
参考文章
http://docs.codehaus.org/display/JETTY/Maven+Jetty+Jspc+Plugin
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.wgame</groupId>
<artifactId>ln3</artifactId>
<packaging>war</packaging>
<name>ln3</name>
<version>1.0</version>
<build>
<finalName>ln3</finalName>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webappDirectory>
${basedir}/web
</webappDirectory>
<warSourceDirectory>
${basedir}/web
</warSourceDirectory>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<profiles>
<profile>
<id>prod</id>
<activation>
<property><name>prod</name></property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-jspc-plugin</artifactId>
<version>6.1.16</version>
<executions>
<execution>
<id>jspc</id>
<goals>
<goal>jspc</goal>
</goals>
<configuration>
<webAppSourceDirectory>
${basedir}/web
</webAppSourceDirectory>
<generatedClasses>
${basedir}/target/jspc
</generatedClasses>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webappDirectory>
${basedir}/web
</webappDirectory>
<warSourceDirectory>
${basedir}/web
</warSourceDirectory>
<webXml>
${basedir}/web/WEB-INF/web.xml
</webXml>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<dependencies>
</dependencies>
</project>
配置了POM.XML后运行命令:
mvn -Dprod package
就将JSP编译好放置在target/jspc目录下了