-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathbuild.xml
49 lines (41 loc) · 1.73 KB
/
build.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<project default="pmd" basedir=".">
<property name="pmd.home" value="please specify property at command line via -Dpmd.home=..."/>
<property name="src" location="src"/>
<property name="build" location="build"/>
<path id="pmd.classpath">
<fileset dir="${pmd.home}/lib/">
<include name="*.jar"/>
</fileset>
</path>
<taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask" classpathref="pmd.classpath" />
<taskdef name="cpd" classname="net.sourceforge.pmd.ant.CPDTask" classpathref="pmd.classpath" />
<target name="init">
<tstamp/>
<mkdir dir="${build}"/>
</target>
<target name="compile" depends="init" description="compile the source">
<javac srcdir="${src}" destdir="${build}" includeAntRuntime="false"/>
</target>
<target name="pmd" depends="compile" description="Analyze code with PMD">
<pmd rulesetfiles="rulesets/java/quickstart.xml" failOnRuleViolation="false" noCache="true">
<auxclasspath>
<pathelement location="${build}"/>
</auxclasspath>
<formatter type="xml" toFile="${build}/pmd-report.xml" />
<formatter type="text" toConsole="true" />
<fileset dir="${src}/">
<include name="**/*.java"/>
</fileset>
</pmd>
</target>
<target name="cpd" depends="compile" description="Find duplicates with CPD">
<cpd minimumTokenCount="100" outputFile="${build}/cpd.txt" language="java" >
<fileset dir="${src}">
<include name="**/*.java"/>
</fileset>
</cpd>
</target>
<target name="clean" description="clean up">
<delete dir="${build}"/>
</target>
</project>