You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by jm...@apache.org on 2005/03/19 04:25:45 UTC

svn commit: r158194 - struts/taglib/trunk/maven.xml

Author: jmitchell
Date: Fri Mar 18 19:25:45 2005
New Revision: 158194

URL: http://svn.apache.org/viewcvs?view=rev&rev=158194
Log:
add jsp precompile capability (not working yet, but its here)

Modified:
    struts/taglib/trunk/maven.xml

Modified: struts/taglib/trunk/maven.xml
URL: http://svn.apache.org/viewcvs/struts/taglib/trunk/maven.xml?view=diff&r1=158193&r2=158194
==============================================================================
--- struts/taglib/trunk/maven.xml (original)
+++ struts/taglib/trunk/maven.xml Fri Mar 18 19:25:45 2005
@@ -1,38 +1,120 @@
-<project default="jar:jar"
-  xmlns:j="jelly:core"
-  xmlns:ant="jelly:ant">
-
-  <postGoal name="dist">
-    <attainGoal name="jar:install"/>
-  </postGoal>
-   
-  <preGoal name="xdoc:jelly-transform">
-    <attainGoal name="html2xdoc"/>
-  </preGoal>
-
-  <!-- Prepare additional Jar resources -->
-  <postGoal name="java:jar-resources">
-    <attainGoal name="struts:generate-tlds"/>
-  </postGoal>
-  
-  
-  <goal name="struts:generate-tlds">
+<project    default="jar:jar"
+            xmlns:j="jelly:core"
+            xmlns:ant="jelly:ant"
+            xmlns:maven="jelly:maven"
+            xmlns:util="jelly:util">
+
+
+	<postGoal name="dist">
+		<attainGoal name="jar:install"/>
+	</postGoal>
+
+	<preGoal name="xdoc:jelly-transform">
+		<attainGoal name="html2xdoc"/>
+	</preGoal>
+
+	<!-- Prepare additional Jar resources -->
+	<postGoal name="java:jar-resources">
+	<attainGoal name="struts:generate-tlds"/>
+	</postGoal>
+
 
-    <!-- Generate TLDs -->
-    ${systemScope.setProperty('javax.xml.transform.TransformerFactory','org.apache.xalan.processor.TransformerFactoryImpl')}
+	<goal name="struts:generate-tlds">
+
+	<!-- Generate TLDs -->
+	${systemScope.setProperty('javax.xml.transform.TransformerFactory','org.apache.xalan.processor.TransformerFactoryImpl')}
 	<ant:style basedir="doc/userGuide"
 		destdir="${maven.build.dir}/classes/META-INF/tlds"
 		extension=".tld"
 		style="doc/stylesheets/tld.xsl"
 		includes="struts-*.xml"/>
-		
-  </goal>
+
+	</goal>
 
 	<preGoal name="java:compile">
 		<mkdir dir="${maven.build.dir}/xdoclet/webdoclet/WEB-INF" />
 		<attainGoal name="xdoclet:webdoclet" />
 	</preGoal>
   
+
+	<preGoal name="war:webapp">
+	  <j:set var="precompileJsp" value="${precompile.jsp}"/>
+	  <j:if test="${precompileJsp == 'true'}">
+		<attainGoal name="precompile-jsp"/>
+	  </j:if>
+	</preGoal>
+
+	<goal name="precompile-jsp" description="Precompile all JSPs into java classes, and then into classes" prereqs="war:load,java:compile">
+	  
+	  <maven:get var="warSource" property="maven.war.src" plugin="maven-war-plugin" />
+	  
+	  <ant:mkdir dir="${maven.build.dir}/jspc"/>
+	  <ant:mkdir dir="${maven.build.dir}/jspc-processed"/>
+	  <ant:mkdir dir="${maven.build.dir}/jspc-classes"/>
+
+	  <j:set var="jspOutDir" value="${maven.build.dir}/jspc"/>
+	  <j:set var="jspClassesOutDir" value="${maven.build.dest}"/>
+	  
+	  <ant:path id="jspc.classpath">
+		<ant:pathelement location="${tomcat.home}/common/lib/jasper-runtime.jar"/>
+		<ant:pathelement location="${tomcat.home}/common/lib/jasper-compiler.jar"/>
+		<ant:pathelement location="${tomcat.home}/common/lib/servlet.jar"/>
+		<ant:path refid="maven.dependency.classpath"/>
+		<ant:pathelement path="${maven.build.dest}"/>
+	  </ant:path>
+	  
+<!--	  
+	  <ant:path id="jspc.classpath">
+		<ant:pathelement location="${tomcat.home}/common/lib/jasper-runtime.jar"/>
+		<ant:pathelement location="${tomcat.home}/common/lib/jasper-compiler.jar"/>
+		<ant:pathelement location="${tomcat.home}/common/lib/servlet-api.jar"/>
+		<ant:pathelement location="${tomcat.home}/common/lib/jsp-api.jar"/>
+		<ant:path refid="maven.dependency.classpath"/>
+		<ant:pathelement path="${maven.build.dest}"/>
+	  </ant:path>
+-->	  
+	  
+	  <ant:taskdef name="jasper2" 
+	  		classname="org.apache.jasper.JspC" 
+	  		classpathref="jspc.classpath"/>
+	  
+	  <echo>jspc.classpath=${jspc.classpath}</echo>
+	  <echo>maven.build.dir=${maven.build.dir}</echo>
+	  <echo>jspOutDir=${jspOutDir}</echo>
+	  <echo>warSource=${warSource}</echo>
+	  <echo>/pom.artifactId=/${pom.artifactId}</echo>
+	  
+	  <ant:jasper2
+		webXmlFragment="${maven.build.dir}/web-fragment.xml"
+		package="${pom.package}.jsp.${pom.artifactId}"
+		outputDir="${jspOutDir}"
+		srcdir="${warSource}"
+		uriroot="${warSource}"
+		uribase="/${pom.artifactId}"
+		verbose="9"/>
+
+	  <ant:javac
+		srcdir="${jspOutDir}"
+		destdir="${jspClassesOutDir}"
+		debug="${maven.compile.debug}"
+		deprecation="${maven.compile.deprecation}"
+		optimize="${maven.compile.optimize}"
+		classpathref="jspc.classpath"/>
+
+	</goal>
+
+
+	<postGoal name="war:webapp">
+	  <j:set var="precompileJsp" value="${precompile.jsp}"/>
+	  <j:if test="${precompileJsp == 'true'}">
+		<maven:get var="target" property="maven.war.webapp.dir" plugin="maven-war-plugin" />
+		<util:available file="${maven.build.dir}/web-fragment.xml">
+		  <util:loadText var="fragment" file="${maven.build.dir}/web-fragment.xml"/>
+		  <ant:replace file="${target}/WEB-INF/web.xml" token="&lt;!-- [INSERT FRAGMENT HERE] --&gt;" value="${fragment}"/>
+		</util:available>
+	  </j:if>
+	</postGoal>
+
 
 
 </project>



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org