You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Pål Brattberg <br...@gmail.com> on 2004/10/19 13:07:09 UTC

Running my own transformation before plugin runs

Hi

I would like to do some transformations on the xml file that the
checkstyle plugin generates, before it's converted into HTML.

Is there a preferred way/any examples of doing this? 

What I would like would look something like this:
$ maven site
   (checkstyle:init:)
   (checkstyle:report:)
   (checkstyle:run:)

   (Insert my own transformation of the XML file generated by
checkstyle to weed out some stuff)

   (maven-checkstyle-plugin:register:)
   (xdoc:jelly-transform:)

Any of you done this sort of thing?

I assume this should be done with some sort of pregoal thingy, but any
help would be appreciated.

TIA

-- 
// pål brattberg
// eminds F/OSS div.
// http://www.eminds.se 

// Need google mail account? Ask me!

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Running my own transformation before plugin runs

Posted by Pål Brattberg <br...@gmail.com>.
> 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"/>
	</postGoal>
	<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}"
				output="checkstyle-report.xml"
				stylesheet="PATH_TO/.maven/plugins/maven-checkstyle-plugin-2.4.1/plugin-resources/checkstyle.jsl"
				encoding="${maven.docs.outputencoding}" outputMode="xml"
prettyPrint="true"/>
		</util:available>
	</goal>

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

I'm running JDK 1.4+ and did not need to add xalan, but you may need
to add the following dependecy:
<dependency>
	<id>xalan</id>
	<version>2.5.1</version>
</dependency>

Hope this helps someone out in the future.

-- 
// pål brattberg
// eminds F/OSS div.
// http://www.eminds.se 

// Need google mail account? Ask me!

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Multiple Remote Repositories setup problem

Posted by Brett Porter <br...@gmail.com>.
No, you don't need special settings. You are getting a 500 error out
of the server - check the server error logs to see what is wrong.

Regards,
Brett

On Tue, 19 Oct 2004 15:44:20 +0200, michele_forte@swissre.com
<mi...@swissre.com> wrote:
> Hello,
> 
> In my project setup i am using an external remote repository, I was used to
> house that repository on Tomcat now I had to change it to Apache web
> server:
> 
> Here is the problem :
> 
> what it was first working no problem with Tomcat :
> 
> now I always get the following error
> 
> Getting URL:
> http://chr54d28/maven-repository/cts/jars/SNMCodeTable-1.0.0.jar
> Response content length is not known
> Received status code: 500
> 
> even if the file exists and is visible via http
> 
> my question is do we need a specific setting of the Apache server in order
> to be used in conjunction with Maven ?
> 
> Any help is welcome
> 
> Michele
> 
> This e-mail, including attachments, is intended for the person(s) or
> company named and may contain confidential and/or legally privileged
> information. Unauthorized disclosure, copying or use of this information
> may be unlawful and is prohibited. If you are not the intended recipient,
> please delete this message and notify the sender
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Multiple Remote Repositories setup problem

Posted by Mi...@swissre.com.
Hello,

In my project setup i am using an external remote repository, I was used to
house that repository on Tomcat now I had to change it to Apache web
server:

Here is the problem :

what it was first working no problem with Tomcat :

now I always get the following error

Getting URL:
http://chr54d28/maven-repository/cts/jars/SNMCodeTable-1.0.0.jar
Response content length is not known
Received status code: 500

even if the file exists and is visible via http

my question is do we need a specific setting of the Apache server in order
to be used in conjunction with Maven ?

Any help is welcome

Michele


This e-mail, including attachments, is intended for the person(s) or
company named and may contain confidential and/or legally privileged
information. Unauthorized disclosure, copying or use of this information
may be unlawful and is prohibited. If you are not the intended recipient,
please delete this message and notify the sender


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org