Author: julien_viet
Date: 2010-10-26 00:48:15 -0400 (Tue, 26 Oct 2010)
New Revision: 4830
Modified:
portal/trunk/packaging/tomcat/pkg/pom.xml
portal/trunk/packaging/tomcat/pkg/transform.xsl
Log:
remove hardcodes in XSLT
Modified: portal/trunk/packaging/tomcat/pkg/pom.xml
===================================================================
--- portal/trunk/packaging/tomcat/pkg/pom.xml 2010-10-26 03:39:10 UTC (rev 4829)
+++ portal/trunk/packaging/tomcat/pkg/pom.xml 2010-10-26 04:48:15 UTC (rev 4830)
@@ -891,7 +891,7 @@
<target>
<!-- Copy tomcat -->
- <copy todir="target/tomcat">
+ <copy todir="${project.build.directory}/tomcat">
<fileset dir="${tomcat.dir}"
excludes="webapps/**"/>
</copy>
@@ -902,13 +902,17 @@
destdir="${project.build.directory}"
includes="pom.xml"
extension=".xml"
- style="${project.basedir}/transform.xsl"/>
- <ant antfile="${project.build.directory}/pom.xml"
inheritRefs="true">
- <target name="foo" />
+ style="${project.basedir}/transform.xsl">
+ <param name="lib.dir"
expression="${project.build.directory}/tomcat/lib"/>
+ <param name="webapps.dir"
expression="${project.build.directory}/tomcat/webapps"/>
+ <mapper type="glob" from="pom.xml"
to="copy-dependencies.xml"/>
+ </xslt>
+ <ant
antfile="${project.build.directory}/copy-dependencies.xml"
inheritRefs="true">
+ <target name="copy-dependencies" />
</ant>
<!-- Copy configuration -->
- <copy todir="target/tomcat">
+ <copy todir="${project.build.directory}/tomcat">
<fileset
dir="${project.basedir}/src/main/resources/tomcat"/>
</copy>
Modified: portal/trunk/packaging/tomcat/pkg/transform.xsl
===================================================================
--- portal/trunk/packaging/tomcat/pkg/transform.xsl 2010-10-26 03:39:10 UTC (rev 4829)
+++ portal/trunk/packaging/tomcat/pkg/transform.xsl 2010-10-26 04:48:15 UTC (rev 4830)
@@ -2,38 +2,42 @@
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-
xmlns:foo="http://maven.apache.org/POM/4.0.0">
+
xmlns:mvn="http://maven.apache.org/POM/4.0.0">
+ <xsl:param name="lib.dir"/>
+ <xsl:param name="webapps.dir"/>
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/" >
- <project name="foo">
- <target name="foo">
- <copy todir="target/tomcat/lib">
- <xsl:for-each
select="//foo:dependencies/foo:dependency[count(foo:type)=0 or
foo:type/text()='jar']">
+ <xsl:comment>Generated file</xsl:comment>
+ <project name="copy-dependencies">
+ <target name="copy-dependencies">
+ <xsl:element name="copy">
+ <xsl:attribute name="todir"><xsl:value-of
select="$lib.dir"/></xsl:attribute>
+ <xsl:for-each
select="//mvn:dependencies/mvn:dependency[count(mvn:type)=0 or
mvn:type/text()='jar']">
<xsl:element name="fileset">
- <xsl:attribute name="refid"><xsl:value-of
select="./foo:groupId"/>:<xsl:value-of
select="./foo:artifactId"/>:jar</xsl:attribute>
+ <xsl:attribute name="refid"><xsl:value-of
select="./mvn:groupId"/>:<xsl:value-of
select="./mvn:artifactId"/>:jar</xsl:attribute>
</xsl:element>
</xsl:for-each>
- </copy>
- <xsl:for-each
select="//foo:dependencies/foo:dependency[foo:type/text()='war']">
- <xsl:variable name="bilto">
+ </xsl:element>
+ <xsl:for-each
select="//mvn:dependencies/mvn:dependency[mvn:type/text()='war']">
+ <xsl:variable name="webapps.name">
<xsl:for-each
select="processing-instruction()[name()='rename']">
<xsl:value-of select="."/>
</xsl:for-each>
</xsl:variable>
<xsl:choose>
- <xsl:when test="$bilto=''">
+ <xsl:when test="$webapps.name=''">
<xsl:element name="copy">
- <xsl:attribute
name="todir">target/tomcat/webapps</xsl:attribute>
+ <xsl:attribute name="todir"><xsl:value-of
select="$webapps.dir"/></xsl:attribute>
<xsl:element name="fileset">
- <xsl:attribute name="refid"><xsl:value-of
select="./foo:groupId"/>:<xsl:value-of
select="./foo:artifactId"/>:war</xsl:attribute>
+ <xsl:attribute name="refid"><xsl:value-of
select="./mvn:groupId"/>:<xsl:value-of
select="./mvn:artifactId"/>:war</xsl:attribute>
</xsl:element>
</xsl:element>
</xsl:when>
<xsl:otherwise>
<xsl:element name="copy">
- <xsl:attribute
name="tofile">target/tomcat/webapps/<xsl:value-of
select="$bilto"/></xsl:attribute>
+ <xsl:attribute name="tofile"><xsl:value-of
select="$webapps.dir"/>/<xsl:value-of
select="$webapps.name"/></xsl:attribute>
<xsl:element name="fileset">
- <xsl:attribute name="refid"><xsl:value-of
select="./foo:groupId"/>:<xsl:value-of
select="./foo:artifactId"/>:war</xsl:attribute>
+ <xsl:attribute name="refid"><xsl:value-of
select="./mvn:groupId"/>:<xsl:value-of
select="./mvn:artifactId"/>:war</xsl:attribute>
</xsl:element>
</xsl:element>
</xsl:otherwise>