maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pål Brattberg <>
Subject Re: Running my own transformation before plugin runs
Date Tue, 19 Oct 2004 13:25:56 GMT
> I would like to do some transformations on the xml file that the
> checkstyle plugin generates, before it's converted into HTML.

Well, seems I was to fast in sending the question.

Unfortunately, I had to make a bit of a kludge, since it's the same
goal in the checkstyle plugin that generates both
checkstyle-raw-report.xml and checkstyle-report.xml. Had these been
two different goals, I would not need to redo the <doc:jsl> step in
maven.xml. Oh well, perhaps I should quit my whining and submit a
patch! ;)

Here's my solution (for better or worse):
In my maven.xml I added the following:

	<postGoal name="checkstyle:report">
		<attainGoal name="removeUnwantedCheckstyleEntries"/>
	<goal name="removeUnwantedCheckstyleEntries" description="Remove bug
output from checkstyle report">
		<echo message="Removing unwanted Checkstyle entries..."/>
		${systemScope.setProperty( 'javax.xml.transform.TransformerFactory',
		'org.apache.xalan.processor.TransformerFactoryImpl')} <j:set
			var="inputFile" value="${basedir}/target/checkstyle-raw-report.xml"/>
		<echo message="infile: ${inputFile}"/>
		<util:available file="${inputFile}">
			<echo message="Input file is present"/>
			<ant:xslt in="${inputFile}" out="${inputFile}.tmp"
				style="${basedir}/../../fixCheckstyle.xsl" processor="trax"/>
			<ant:move file="${inputFile}.tmp" tofile="${inputFile}"/>
			<doc:jsl input="${inputFile}"
				encoding="${}" outputMode="xml"

And I also created this XSL file:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="">
	<xsl:template match="*">
			<xsl:copy-of select="@*" />
			<xsl:apply-templates />
	<xsl:template match="error">
			<xsl:when test="starts-with(@message,'Unable to get class information for')">
				<xsl:apply-templates />
					<xsl:copy-of select="@*" />
					<xsl:apply-templates />

I'm running JDK 1.4+ and did not need to add xalan, but you may need
to add the following dependecy:

Hope this helps someone out in the future.

// pål brattberg
// eminds F/OSS div.

// Need google mail account? Ask me!

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message