I modify clover:test goal to use the correctly maven properties

 
______________________________________________________________________________
ifrance.com, l'email gratuit le plus complet de l'Internet !
vos emails depuis un navigateur, en POP3, sur Minitel, sur le WAP...
http://www.ifrance.com/_reloc/email.emailif

<?xml version="1.0"?>

<project xmlns:j="jelly:core">

  <!-- =================================================================== -->
  <!-- Prepare for clover                                                  -->
  <!-- =================================================================== -->

  <goal
    name="clover:prepare"
    description="Create the needed directory structure">

    <!-- The clover.initstring must be defined and must point to the database
         file -->
    
    <property name="clover.initstring"
        value="${maven.clover.database.dir}/clover_coverage.db"/>

    <mkdir dir="${maven.build.clover}"/>
    <mkdir dir="${maven.build.clover.classes}"/>
    <mkdir dir="${maven.clover.database.dir}"/>
    
    <attainGoal name="java:compile"/>
    <attainGoal name="test:compile"/>
    
  </goal>

  <!-- =================================================================== -->
  <!-- Compile with Clover to instrument source code                       -->
  <!-- =================================================================== -->
  <goal
    name="clover:compile"
    description="Compile with Clover to instrument source code"
    prereqs="clover:prepare">

    <property name="build.compiler"
        value="org.apache.tools.ant.taskdefs.CloverCompilerAdapter"/>

    <javac
      destdir="${maven.build.clover.classes}"
      excludes="**/package.html"
      debug="${maven.compile.debug}"
      deprecation="${maven.compile.deprecation}"
      optimize="${maven.compile.optimize}">
      <src>
        <path refid="maven.compile.src.set"/>
      </src>
      <classpath>
        <path refid="maven.dependency.classpath"/>
        <pathelement path="${maven.build.dest}"/>
      </classpath>
    </javac>

    <!-- jarResources copy -->
    <copy todir="${maven.build.clover.classes}">
      <fileset dir="${maven.jarResources.basedir}">
        <patternset refid="maven.jar.resources.set"/>
      </fileset>
    </copy>

  </goal>

  <!-- =================================================================== -->
  <!-- Run unit tests with Clover                                          -->
  <!-- =================================================================== -->

  <goal
    name="clover:test"
    description="Run unit tests with Clover"
    prereqs="clover:compile">

    <j:if test="${unitTestSourcesPresent == 'true'}">
    
      <junit printSummary="yes" failureProperty="maven.test.failure"
          fork="${maven.junit.fork}" dir="${maven.junit.dir}">
        <sysproperty key="basedir" value="${basedir}"/>
        <formatter type="xml"/>
        <formatter type="plain" usefile="${maven.junit.usefile}"/>
        <classpath>
          <path refid="maven.dependency.classpath"/>
          <pathelement location="${maven.build.clover.classes}"/>
          <pathelement location="${maven.test.dest}"/>
        </classpath>
        <batchtest todir="${maven.test.reportsDirectory}">
          <fileset dir="${pom.build.unitTestSourceDirectory}">
	          <j:forEach var="pat" items="${pom.build.unitTest.includes}">
	            <include name="${pat}"/>
	          </j:forEach>
	          <j:forEach var="pat" items="${pom.build.unitTest.excludes}">
	            <exclude name="${pat}"/>
	          </j:forEach>
          </fileset>
        </batchtest>
      </junit>
    
    </j:if>

  </goal>

  <!-- =================================================================== -->
  <!-- C L O V E R  R E P O R T S                                          -->
  <!-- =================================================================== -->

  <goal name="clover"
        description="Generate HTML test coverage reports with Clover"
        prereqs="clover:test, clover:html-report"/>

  <goal
    name="clover:html-report"
    description="Generate HTML test coverage reports with Clover">

    <mkdir dir="${maven.docs.dest}/clover"/>

    <java classname="com.cortexeb.tools.clover.reporters.html.HtmlReporter"
      fork="true">
      <arg line="--outputdir ${maven.docs.dest}/clover"/>
      <arg line="--showSrc"/>
      <arg line="--initstring ${clover.initstring}"/>
      <arg line="--title '${maven.name} - ${maven.currentVersion}'"/>
      <classpath>
        <path refid="maven-classpath"/>
        <pathelement path="${java.class.path}"/>
      </classpath>
    </java>

  </goal>

  <goal
    name="clover:swing-report"
    description="Generate Swing test coverage reports with Clover">

    <mkdir dir="${maven.docs.dest}/clover"/>

    <java classname="com.cortexeb.tools.clover.reporters.jfc.Viewer"
        fork="yes">
        <arg line="${clover.initstring}"/>
        <classpath>
            <path refid="maven-classpath"/>
            <pathelement path="${java.class.path}"/>
        </classpath>
    </java>

  </goal>

</project>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to