Skip to content

Instantly share code, notes, and snippets.

@yangboz yangboz/JAVA_CPD.xml
Created Oct 23, 2012

What would you like to do?
Ant xml example for JAVA code CPD.
<?xml version="1.0"?>
<project name="XXX Application Build with CPD" default="run"
Ant build sample for running
- CPD,
<!-- Change the paths to your individual installation directories -->
<property name="cpd.home.dir" location="${basedir}/tools/cpd/" />
<property name="lib.dir" location="${basedir}/map/lib" />
<property name="src.dir" location="${basedir}/map/app/" />
<property name="bin.dir" location="${basedir}/bin" />
<property name="htm.dir" location="${basedir}/html" />
<property name="report.dir" location="${basedir}/report" />
<property name="report.cpd.dir" location="${report.dir}/cpd" />
<!-- Task of clean -->
<target name="clean" description="Delete all result to start with a clean build.">
<delete dir="${report.cpd.dir}" />
<delete dir="${report.temp.dir}" />
<delete dir="${bin.dir}" />
<!-- Task of prepare report -->
<target name="" description="Prepares the reports folder">
<mkdir dir="${report.cpd.dir}" />
<!-- -->
<path id="cpd.classpath">
<pathelement location="${build}" />
<fileset dir="${cpd.home.dir}/lib/">
<include name="*.jar" />
<!-- Task of CPD -->
<target name="cpd">
<taskdef name="cpd" classname="net.sourceforge.pmd.cpd.CPDTask"
classpathref="cpd.classpath" />
<cpd minimumTokenCount="100" format="xml" language="java"
ignoreIdentifiers="true" ignoreLiterals="true"
<fileset dir="${src.dir}">
<include name="**/*.java" />
<!-- -->
<target name="run" description="Run the build" depends="clean,,cpd">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.