Author: ozizka(a)redhat.com
Date: 2009-11-07 02:24:09 -0500 (Sat, 07 Nov 2009)
New Revision: 849
Modified:
trunk/jsfunit/pom.xml
trunk/jsfunit/src/build/resources/switch-web.xml-to-myfaces.xsl
Log:
* POM: Workaround for Maven XML plugin bug (MOJO-1453)
* XSLT: Workadound for Java implementation which doesn't allow to have "-"
in the node name.
Modified: trunk/jsfunit/pom.xml
===================================================================
--- trunk/jsfunit/pom.xml 2009-11-07 05:55:37 UTC (rev 848)
+++ trunk/jsfunit/pom.xml 2009-11-07 07:24:09 UTC (rev 849)
@@ -851,20 +851,19 @@
<executions>
<execution>
<id>switch-web.xml-to-myfaces</id> <goals>
<goal>transform</goal> </goals>
- <phase>process-resources</phase>
+ <phase>package</phase>
<configuration>
<transformationSets>
- <outputDir>${basedir}/testdata</outputDir>
- <!--
http://xerces.apache.org/xerces2-j/javadocs/api/javax/xml/transform/Trans...
-->
- <!-- javax.xml.transform.OutputKeys.INDENT -->
- <outputProperties>
- <outputProperty>
<
name>{http://xml.apache.org/xslt}indent-amount</name><value&g...
</outputProperty>
- <outputProperty>
<name>indent</name><value>yes</value> </outputProperty>
- </outputProperties>
<transformationSet>
-
<stylesheet>${basedir}/src/build/resources/switch-web.xml-to-myfaces.xslt</stylesheet>
+
<outputDir>${project.build.directory}/war/work/org.jboss.jopr/jopr-embedded-jbas5</outputDir>
<!-- /WEB-INF:
http://jira.codehaus.org/browse/MOJO-1453 -->
+ <!-- javax.xml.transform.OutputKeys.INDENT -->
+ <outputProperties>
+ <outputProperty>
<
name>{http://xml.apache.org/xslt}indent-amount</name><value&g...
</outputProperty>
+ <outputProperty>
<name>indent</name><value>yes</value> </outputProperty>
+ </outputProperties>
+
<stylesheet>${basedir}/src/build/resources/switch-web.xml-to-myfaces.xsl</stylesheet>
<dir>${project.build.directory}/war/work/org.jboss.jopr/jopr-embedded-jbas5/WEB-INF</dir>
- <includes>web.xml</includes>
+
<includes><include>web.xml</include></includes>
</transformationSet>
</transformationSets>
</configuration>
@@ -872,6 +871,24 @@
</executions>
</plugin>
+ <!-- AntRun - move the modified web.xml - overwrite the original
(MOJO-1453 workaround) . -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <!-- This has to be named this way, otherwise it would execute AFTER
web.xml XSLT processing. That's Maven. -->
+ <id>delete_bundled_admin_console_war</id> <!--
move-new-web.xml-overwrite-the-original-one -->
+ <phase>package</phase>
+ <configuration><tasks>
+ <echo>Moving
${project.build.directory}/war/work/org.jboss.jopr/jopr-embedded-jbas5/web.xml to
${project.build.directory}/war/work/org.jboss.jopr/jopr-embedded-jbas5/WEB-INF/web.xml</echo>
+ <move
file="${project.build.directory}/war/work/org.jboss.jopr/jopr-embedded-jbas5/web.xml"
todir="${project.build.directory}/war/work/org.jboss.jopr/jopr-embedded-jbas5/WEB-INF"
/>
+ </tasks></configuration>
+ <goals><goal>run</goal></goals>
+ </execution>
+ </executions>
+ </plugin>
+
</plugins>
</build>
</profile>
Modified: trunk/jsfunit/src/build/resources/switch-web.xml-to-myfaces.xsl
===================================================================
--- trunk/jsfunit/src/build/resources/switch-web.xml-to-myfaces.xsl 2009-11-07 05:55:37
UTC (rev 848)
+++ trunk/jsfunit/src/build/resources/switch-web.xml-to-myfaces.xsl 2009-11-07 07:24:09
UTC (rev 849)
@@ -10,14 +10,11 @@
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="xml"/>
- <xsl:template match="@*|node()">
- <xsl:copy>
- <xsl:apply-templates select="@*|node()"/>
- </xsl:copy>
- </xsl:template>
+
<!-- Add org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL after last context-param.
-->
- <xsl:template match="/web-app/context-param[position()=last()]">
+ <!-- /web-app/context-param[position()=last()] -->
+ <xsl:template
match="/*[name()='web-app']/*[name()='context-param' and
position()=1]">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
@@ -30,11 +27,25 @@
<param-value>true</param-value>
</context-param>
</xsl:template>
+ <!-- TEST
+ <xsl:template
match="X/*[name()='web-app']/*[name()='context-param' and position()
= (1) ]">
+ FOO <xsl:value-of select="last()"/>
+ </xsl:template>
+ -->
+
+
<!-- Replace RichFaces listener with MyFaces -->
<!--
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
-->
- <xsl:template match="/web-app/listener/listener-class[contains(
normalize-space(), 'com.sun.faces.config.ConfigureListener' )]">
+ <xsl:template
match="/*[name()='web-app']/*/*[name()='listener-class' and contains(
normalize-space(), 'com.sun.faces.config.ConfigureListener' )]">
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
</xsl:template>
+ <xsl:template match="@*|node()">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()"/>
+ </xsl:copy>
+ </xsl:template>
+
+
</xsl:stylesheet>