vmassol 2003/11/05 23:02:30
Modified: clover plugin.jelly
clover/xdocs changes.xml
Log:
Prevent the plugin from failing if the project on which it is run has no java
sources/test sources.
Revision Changes Path
1.12 +29 -20 maven-plugins/clover/plugin.jelly
Index: plugin.jelly
===================================================================
RCS file: /home/cvs/maven-plugins/clover/plugin.jelly,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- plugin.jelly 5 Nov 2003 19:01:47 -0000 1.11
+++ plugin.jelly 6 Nov 2003 07:02:30 -0000 1.12
@@ -6,7 +6,8 @@
xmlns:maven="jelly:maven"
xmlns:java="java"
xmlns:test="test"
- xmlns:doc="doc">
+ xmlns:doc="doc"
+ xmlns:u="jelly:util">
<java:dependency-handle/>
<j:set var="javaPlugin" value="${pom.getPluginContext('maven-java-plugin')}"/>
@@ -21,13 +22,6 @@
<ant:pathelement path="${plugin.getDependencyPath('clover')}"/>
</ant:path>
- <!--j:set var="tmp.clover.excludes">
- <j:forEach var="pat" items="${pom.build.unitTest.includes}"> ${pat} </j:forEach>
- </j:set>
-
- <ant:property name="clover.excludes" value="${tmp.clover.excludes}"/-->
-
-
<goal name="maven-clover-plugin:register">
<j:if test="${sourcesPresent == 'true'}">
<doc:registerReport
@@ -48,7 +42,6 @@
<attainGoal name="clover:html-report"/>
</goal>
-
<!-- =================================================================== -->
<!-- Prepare for clover -->
<!-- =================================================================== -->
@@ -59,11 +52,14 @@
<ant:taskdef resource="clovertasks"/>
<ant:typedef resource="clovertypes"/>
+
+ <j:set var="cloverDatabase"
+ value="${maven.clover.database.dir}/clover_coverage.db"/>
<preGoal name="java:compile">
<echo>Setting Clover compiler</echo>
<ant:clover-setup
- initstring="${maven.clover.database.dir}/clover_coverage.db"
+ initstring="${cloverDatabase}"
flushpolicy="interval"
flushinterval="500"
/>
@@ -75,7 +71,7 @@
${pom.getContext().removeVariable('build.compiler')}
</postGoal>
- <clover-setup initstring="${maven.clover.database.dir}/clover_coverage.db"/>
+ <clover-setup initstring="${cloverDatabase}"/>
<j:set var="cloverReportDirectory" value="${maven.docs.dest}/clover"/>
@@ -124,15 +120,28 @@
========================================================================
-->
<goal name="clover:report" prereqs="clover:test">
- <j:if test="${context.getVariable('maven.clover.report.xml') == 'true'}">
- <attainGoal name="clover:xml-report-internal"/>
- </j:if>
- <j:if test="${context.getVariable('maven.clover.report.html') == 'true'}">
- <attainGoal name="clover:html-report-internal"/>
- </j:if>
- <j:if test="${context.getVariable('maven.clover.report.swing') == 'true'}">
- <attainGoal name="clover:swing-report-internal"/>
- </j:if>
+
+ <!-- Skip reports if no coverage database has been created. -->
+ <u:file var="cloverDatabasAsFile" name="${cloverDatabase}"/>
+ <j:choose>
+ <j:when test="${cloverDatabaseAsFile.exists()}">
+
+ <j:if test="${context.getVariable('maven.clover.report.xml') == 'true'}">
+ <attainGoal name="clover:xml-report-internal"/>
+ </j:if>
+ <j:if test="${context.getVariable('maven.clover.report.html') == 'true'}">
+ <attainGoal name="clover:html-report-internal"/>
+ </j:if>
+ <j:if test="${context.getVariable('maven.clover.report.swing') == 'true'}">
+ <attainGoal name="clover:swing-report-internal"/>
+ </j:if>
+
+ </j:when>
+ <j:otherwise>
+ <ant:echo>No Clover database found, skipping report generation</ant:echo>
+ </j:otherwise>
+ </j:choose>
+
</goal>
<!--
1.10 +4 -0 maven-plugins/clover/xdocs/changes.xml
Index: changes.xml
===================================================================
RCS file: /home/cvs/maven-plugins/clover/xdocs/changes.xml,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- changes.xml 5 Nov 2003 19:01:47 -0000 1.9
+++ changes.xml 6 Nov 2003 07:02:30 -0000 1.10
@@ -9,6 +9,10 @@
<body>
<release version="1.3" date="in CVS">
+ <action dev="vmassol" type="fix">
+ Prevent the plugin from failing if the project on which it is run
+ has no java sources/test sources.
+ </action>
<action dev="vmassol" type="update">
Added optional properties to decide what reports to generate. Added
a <code>clover:report</code> goal which generates all the defined
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]