Changing AS 7 configuration (standalone.xml) with XSLT template from Maven

See also: Changing AS 7 configuration (standalone.xml) with XSLT

 

In AS 7 testsuite, we use XSLT transformation to change configuration in standalone.xml / domain.xml .

 

This is how we call it from Maven's pom.xml using xml-maven-plugin:

 

 

<!--
    Adjust IP addresses used in server config files.
 -->
<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>xml-maven-plugin</artifactId>
    <executions combine.children="append">
        <execution>
            <id>update-ip-addresses-jbossas.server</id>
            <phase>process-test-resources</phase>
            <goals><goal>transform</goal></goals>
            <inherited>false</inherited>
            <configuration>
                <transformationSets>
                    <transformationSet>
                        <dir      >${basedir}/target/jbossas/standalone/configuration</dir>
                        <outputDir>${basedir}/target/jbossas/standalone/configuration</outputDir>
                        <stylesheet>${xslt.scripts.dir}/changeIPAddresses.xsl</stylesheet>
                        <includes>
                            <include>standalone*.xml</include>
                        </includes>
                        <parameters>
                            <parameter>
                                <name>managementIPAddress</name>
                                <value>${node0}</value>
                            </parameter>
                            <parameter>
                                <name>publicIPAddress</name>
                                <value>${node0}</value>
                            </parameter>
                        </parameters>
                    </transformationSet>
                </transformationSets>
            </configuration>
        </execution>

        <execution>
             <id>update-datasource.server</id>
             <phase>process-test-resources</phase>
             <goals><goal>transform</goal></goals>
             <inherited>false</inherited>
             <configuration>
                  <transformationSets>
                         <transformationSet>
                <dir      >${basedir}/target/jbossas/standalone/configuration</dir>
                <outputDir>${basedir}/target/jbossas/standalone/configuration</outputDir>
                <stylesheet>${xslt.scripts.dir}/changeDatabase.xsl</stylesheet>
                <includes>
                    <include>standalone*.xml</include>
                </includes>
                <parameters>
                    <parameter>
                        <name>ds.jdbc.driver.jar</name>
                        <value>${ds.jdbc.driver.jar}</value>
                    </parameter>
                    <parameter>
                        <name>ds.jdbc.url</name>
                        <value>${ds.jdbc.url}</value>
                    </parameter>
                    <parameter>
                        <name>ds.jdbc.user</name>
                        <value>${ds.jdbc.user}</value>
                    </parameter>
                    <parameter>
                        <name>ds.jdbc.pass</name>
                        <value>${ds.jdbc.pass}</value>
                    </parameter>
                </parameters>
                       </transformationSet>
                   </transformationSets>
              </configuration>
         </execution>
    </executions>
    <dependencies>
        <dependency>
            <groupId>net.sf.saxon</groupId>
            <artifactId>saxon</artifactId>
            <version>${version.saxon}</version>
        </dependency>
    </dependencies>
</plugin>