Prevent the plugin from failing if the project on which it is run has no java sources/test sources.
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@114268 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -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>
|
||||
|
||||
<!--
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user