Introduce default configuration that applies to all transformationSets
----------------------------------------------------------------------
Key: MOJO-1710
URL: https://jira.codehaus.org/browse/MOJO-1710
Project: Mojo
Issue Type: Improvement
Components: xml
Affects Versions: xml-maven-plugin 1.0
Environment: Maven 3.0.3
Reporter: Falko Modler
Assignee: Jochen Wiedmann
In our project we apply two different stylesheets to the very same set of xsd
files. For this we need two transformationSets:
{code:xml}
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xml-maven-plugin</artifactId>
<executions>
<execution>
<id>generate_meta</id>
<phase>process-resources</phase>
<goals>
<goal>transform</goal>
</goals>
<configuration>
<transformationSets>
<transformationSet>
<dir>${basedir}/src/main/resources/wsdl/xsd</dir>
<stylesheet>${basedir}/src/main/resources/xsl/xsd2csvmeta.xsl</stylesheet>
<includes>
<param>Common.xsd</param>
<param>*ServiceParam.xsd</param>
</includes>
<fileMappers>
<fileMapper
implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper">
<targetExtension>.xml</targetExtension>
</fileMapper>
</fileMappers>
<outputDir>${project.build.outputDirectory}/csv_meta</outputDir>
</transformationSet>
<transformationSet>
<dir>${basedir}/src/main/resources/wsdl/xsd</dir>
<stylesheet>${basedir}/src/main/resources/xsl/xsd2dozer.xsl</stylesheet>
<parameters>
<parameter>
<name>outputdir</name>
<value>${project.build.outputDirectory}/dozer_mappings</value>
</parameter>
</parameters>
<includes>
<param>Common.xsd</param>
<param>*ServiceParam.xsd</param>
</includes>
<fileMappers>
<fileMapper
implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper">
<targetExtension>.xml</targetExtension>
</fileMapper>
</fileMappers>
<outputDir>${project.build.outputDirectory}/dozer_mappings_trash</outputDir>
</transformationSet>
</transformationSets>
</configuration>
</execution>
</executions>
</plugin>
{code}
As you can see, we have to repeat {{dir}}, {{includes}} and {{fileMappers}}
which increases code clutter and might lead to inconsistencies.
It would come in handy if one could define such common properties once, for
instance in an {{transformationSetsDefaults}} element:
{code:xml}
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xml-maven-plugin</artifactId>
<executions>
<execution>
<id>generate_meta</id>
<phase>process-resources</phase>
<goals>
<goal>transform</goal>
</goals>
<configuration>
<transformationSetsDefaults>
<dir>${basedir}/src/main/resources/wsdl/xsd</dir>
<includes>
<param>Common.xsd</param>
<param>*ServiceParam.xsd</param>
</includes>
<fileMappers>
<fileMapper
implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper">
<targetExtension>.xml</targetExtension>
</fileMapper>
</fileMappers>
</transformationSetsDefaults>
<transformationSets>
<transformationSet>
<stylesheet>${basedir}/src/main/resources/xsl/xsd2csvmeta.xsl</stylesheet>
<outputDir>${project.build.outputDirectory}/csv_meta</outputDir>
</transformationSet>
<transformationSet>
<stylesheet>${basedir}/src/main/resources/xsl/xsd2dozer.xsl</stylesheet>
<parameters>
<parameter>
<name>outputdir</name>
<value>${project.build.outputDirectory}/dozer_mappings</value>
</parameter>
</parameters>
<outputDir>${project.build.outputDirectory}/dozer_mappings_trash</outputDir>
</transformationSet>
</transformationSets>
</configuration>
</execution>
</executions>
</plugin>
{code}
Thoughts on the implementation:
This new {{transformationSetsDefaults}} element could be of type
{{org.codehaus.mojo.xml.transformer.TransformationSet}}.
For the actual execution, the Mojo could take it as a template and merge it
with the specific {{transformationSet}} properties.
Properties of the specific {{transformationSet}} should always overwrite the
ones from {{transformationSetsDefaults}}.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email