Use commons-lang StringUtils for string replacement to fix maven 1.0 compatibility issues.

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@372636 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
ltheussl 2006-01-26 22:35:18 +00:00
parent 0b100a389b
commit b3fa3b0428
4 changed files with 22 additions and 12 deletions

View File

@ -125,6 +125,7 @@
<j:forEach var="reactorProject" items="${reactorProjects}"> <j:forEach var="reactorProject" items="${reactorProjects}">
<u:available <u:available
file="${reactorProject.context.getVariable('maven.build.dir')}/dashboard-single.xml"> file="${reactorProject.context.getVariable('maven.build.dir')}/dashboard-single.xml">
<!-- FIXME: this should be maven.dashboard.report.single -->
<x:element name="project"> <x:element name="project">
<x:attribute name="name">${reactorProject.name}</x:attribute> <x:attribute name="name">${reactorProject.name}</x:attribute>
@ -187,6 +188,8 @@
--> -->
<goal name="dashboard:report-single"> <goal name="dashboard:report-single">
<j:useBean var="stringUtils" class="org.apache.commons.lang.StringUtils"/>
<a:dirname property="singleReportDir" file="${maven.dashboard.report.single}"/> <a:dirname property="singleReportDir" file="${maven.dashboard.report.single}"/>
<a:mkdir dir="${singleReportDir}"/> <a:mkdir dir="${singleReportDir}"/>
@ -240,6 +243,7 @@
this is report used by the Clover aggregators to extract information this is report used by the Clover aggregators to extract information
from). The reason we disable the other reports is to win some response from). The reason we disable the other reports is to win some response
time. --> time. -->
<!-- FIXME: pom.getVariable? -->
<j:set var="cloverReportXml" <j:set var="cloverReportXml"
value="${pom.getVariable('maven.clover.report.xml')}"/> value="${pom.getVariable('maven.clover.report.xml')}"/>
<j:set var="maven.clover.report.xml" value="true" scope="parent"/> <j:set var="maven.clover.report.xml" value="true" scope="parent"/>

View File

@ -129,5 +129,15 @@
<organization>IT20one GmbH</organization> <organization>IT20one GmbH</organization>
</contributor> </contributor>
</contributors> </contributors>
<dependencies/> <dependencies>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.0</version>
<url>http://jakarta.apache.org/commons/lang/</url>
<properties>
<comment>This library is already loaded by maven's core. Be careful to use the same version number as in the core.</comment>
</properties>
</dependency>
</dependencies>
</project> </project>

View File

@ -30,13 +30,10 @@
<j:choose> <j:choose>
<j:when test="${artifactAsFile.exists()}"> <j:when test="${artifactAsFile.exists()}">
<u:loadText encoding="UTF-8" file="${maven.dashboard.aggregator.coberturalipc.artifact}" var="artifactAsText" /> <u:loadText file="${maven.dashboard.aggregator.coberturalipc.artifact}" var="artifactAsText" />
<u:replace new="" old="&lt;!DOCTYPE coverage SYSTEM &#0034;http://cobertura.sourceforge.net/xml/coverage-02.dtd&#0034;>" <j:set var="fileWithoutDTD" value="${stringUtils.replace(artifactAsText, '&lt;!DOCTYPE coverage SYSTEM &#0034;http://cobertura.sourceforge.net/xml/coverage-02.dtd&#0034;>', '')}"/>
var="fileWithoutDTD" value="${artifactAsText}"/>
<x:parse var="doc" text="${fileWithoutDTD}"/> <x:parse var="doc" text="${fileWithoutDTD}"/>
<x:expr select="floor(100*count($doc/coverage/packages/package/classes/class/lines/line[@hits>0]) div count($doc/coverage/packages/package/classes/class/lines/line[@number>0])+0.5)"/> <x:expr select="floor(100*count($doc/coverage/packages/package/classes/class/lines/line[@hits>0]) div count($doc/coverage/packages/package/classes/class/lines/line[@number>0])+0.5)"/>
%
</j:when> </j:when>
<j:otherwise> <j:otherwise>
<j:expr value="-"/> <j:expr value="-"/>

View File

@ -30,9 +30,8 @@
<j:choose> <j:choose>
<j:when test="${artifactAsFile.exists()}"> <j:when test="${artifactAsFile.exists()}">
<u:loadText encoding="UTF-8" file="${maven.dashboard.aggregator.coberturaloc.artifact}" var="artifactAsText" /> <u:loadText file="${maven.dashboard.aggregator.coberturaloc.artifact}" var="artifactAsText" />
<u:replace new="" old="&lt;!DOCTYPE coverage SYSTEM &#0034;http://cobertura.sourceforge.net/xml/coverage-02.dtd&#0034;>" <j:set var="fileWithoutDTD" value="${stringUtils.replace(artifactAsText, '&lt;!DOCTYPE coverage SYSTEM &#0034;http://cobertura.sourceforge.net/xml/coverage-02.dtd&#0034;>', '')}"/>
var="fileWithoutDTD" value="${artifactAsText}"/>
<x:parse var="doc" text="${fileWithoutDTD}"/> <x:parse var="doc" text="${fileWithoutDTD}"/>
<x:expr select="count($doc/coverage/packages/package/classes/class/lines/line[@number>0])"/> <x:expr select="count($doc/coverage/packages/package/classes/class/lines/line[@number>0])"/>
</j:when> </j:when>