New upstream release.
[debian/jabref.git] / build.xml
1 <?xml version="1.0"?>
2 <!--++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3    Filename: $RCSfile$
4    Purpose:  Ant build file for Jabref.
5
6              Ant-Download: http://jakarta.apache.org/ant
7              Ant-Manual:   http://jakarta.apache.org/ant/manual/index.html
8
9              Jabref-Homepage:    http://jabref.sourceforge.net
10              Jabref@SourceForge: http://sourceforge.net/projects/jabref
11              Jabref@FreshMeat:   http://freshmeat.net
12              Jabref-CVSRoot:     :pserver:anonymous@cvs.jabref.sourceforge.net:/cvsroot/jabref
13
14              Further questions:
15                help mailing list:      must be inserted
16
17    Precondition: 1. Ant should be installed.
18                  2. JAVA_HOME environment variable contains the path to JDK1.5 or higher
19                  3. ANT_HOME environment variable contains the path to ant's home directory
20
21    Language: XML
22    Compiler: Ant
23    Authors:  Joerg K. Wegner, wegnerj@informatik.uni-tuebingen.de
24              Morten O. Alver
25    Version:  $Revision: 2784 $
26              $Date: 2008-10-07 20:06:21 +0200 (Tue, 07 Oct 2008) $
27              $Author: mortenalver $
28
29    modified:
30              23.11.2006 c.oezbek
31              - tried to fix classpath issues
32              28.07.2005 r.nagel
33              - insert dynamic build info generation (resource/build.properties)
34              - copy fonts directory, used by the new about dialog
35              - change static "version" into mainfest file into ${jabref.version}
36              09.06.2005 r.nagel
37              - bugfix, first it should be made a rebuild of the build directory
38              and then a jar should be generated from this directory
39              - take all files for the jar archive !!! FROM BUILD directory !!!
40
41 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->
42
43 <project name="JabRef" default="jars" basedir=".">
44
45         <!--++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
46         PROPERTY SETUP
47      +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->
48
49         <!-- some version information -->
50         <property name="jabref.version" value="2.4.2" />
51         <property name="jabref.placeholder.version" value="@version@" />
52         <!-- used by replace task -->
53
54         <!-- Set the properties for intermediate directory -->
55         <property name="build.jar" value="JabRef-${jabref.version}.jar" />
56         <property name="build.dir" value="build" />
57         <property name="build.classes" value="${build.dir}/classes" />
58         <property name="build.tmp" value="${build.dir}/tmp" />
59         <property name="build.osx" value="${build.dir}/classes/osxadapter" />
60         <property name="build.lib" value="${build.dir}/lib" />
61         <property name="build.win" value="${build.dir}/windows" />
62         <property name="build.images" value="${build.dir}/images" />
63         <property name="build.fonts" value="${build.dir}/images/font" />
64         <property name="build.resource" value="${build.dir}/resource" />
65         <property name="build.help" value="${build.dir}/help" />
66         <property name="build.javadocs" value="${build.dir}/docs/API" />
67         <property name="build.extensions" value="${build.dir}/extensions" />
68         <property name="build.extension-javadocs" value="${build.extensions}/API" />
69         <property name="build.extension-layout" value="${build.extensions}/layout" />
70         <property name="build.openoffice.meta" value="${build.resource}/openoffice" />
71         <property name="build.tests" value="${build.dir}/tests" />
72
73         <!-- Set the properties for source directories -->
74         <property name="src.dir" value="src" />
75         <property name="src.tests" value="src/java/tests" />
76         <property name="plugin.dir" value="src/plugins/" />
77         <property name="txt.dir" value="src/txt" />
78         <property name="java.dir" value="${src.dir}/java" />
79         <property name="osx.dir" value="${src.dir}/osx" />
80         <property name="win.installer.dir" value="${src.dir}/windows/nsis" />
81         <property name="resource.dir" value="${src.dir}/resource" />
82         <property name="bin.dir" value="${src.dir}/scripts" />
83         <property name="images.dir" value="${src.dir}/images" />
84         <property name="fonts.dir" value="${src.dir}/images/font" />
85         <property name="help.dir" value="${src.dir}/help" />
86         <property name="extensions.dir" value="${src.dir}/extensions" />
87         <property name="layout.dir" value="${src.dir}/resource/layout" />
88         <property name="lib.dir" value="lib" />
89         <property name="tests.dir" value="${src.dir}/tests" />
90
91         <property name="nsis.executable" value="makensis.exe"/>
92         <property name="nsis.executable.linux" value="makensis"/>
93
94         <!-- Load user dependent properties -->
95         <!-- For instance to redefine the NSIS-compiler write 
96                 nsis.executable="d:\prog\dev\NSIS\makensis.exe"
97           -->
98         <property file="user.properties" />
99
100         <!-- win.installer can only be build under Windows if the nsis.executable is found -->
101         <condition property="is.windows">
102           <and>
103             <isset property="nsis.executable" />
104             <os family="windows" />
105           </and>
106         </condition>
107
108         <fileset id="jarsFileset" dir="${lib.dir}">
109                 <include name="antlr.jar" />
110                 <include name="antlr-3.0b5.jar" />
111                 <include name="looks-2.2.0.jar" />
112                 <include name="forms-1.1.0.jar" />
113                 <include name="spin.jar" />
114                 <include name="glazedlists-1.7.0_java15.jar" />
115                 <include name="microba.jar" />
116                 <include name="PDFBox-0.7.3-dev-reduced.jar" />
117                 <include name="JempBox-0.2.0.jar" />
118                 <include name="zoom-java.jar" />
119         <include name="mysql-connector-java-5.0.7-bin.jar" />
120         <!--<include name="substance-4.1.jar" />-->
121         <!-- Plugin runtime dependencies -->
122                 <include name="plugin/JPFCodeGenerator-rt.jar" />
123                 <include name="plugin/jpf.jar" />
124                 <include name="plugin/jpf-boot.jar" />
125                 <include name="plugin/commons-logging.jar" />
126         </fileset>
127
128         <!-- Build classpath -->
129         <path id="classpath">
130                 <pathelement path="${build.classes}" />
131                 <pathelement path="${build.dir}" />
132                 <fileset refid="jarsFileset" />
133         </path>
134
135         <!-- Classpath for running the code generator -->
136         <path id="codegenerator">
137                 <pathelement location="${lib.dir}/plugin/JPFCodeGenerator.jar" />
138                 <pathelement location="${lib.dir}/plugin/jpf.jar" />
139                 <pathelement location="${lib.dir}/plugin/jpf-boot.jar" />
140                 <pathelement location="${lib.dir}/plugin/velocity-dep-1.5.jar" />
141         </path>
142
143         <!-- Classpath for tests -->
144         <path id="classpathTest">
145                 <path refid="classpath" />
146                 <pathelement location="${lib.dir}/junit.jar" />
147         </path>
148
149         <target name="run" depends="build">
150                 <java classname="net.sf.jabref.JabRefMain" fork="true">
151                         <classpath refid="classpath" />
152                 </java>
153         </target>
154
155         <!-- Runs project -->
156         <target name="runFromJar">
157                 <java dir="${build.lib}" classname="net.sf.jabref.JabRefMain" fork="true">
158                         <classpath>
159                                 <pathelement location="${build.lib}/${build.jar}" />
160                         </classpath>
161                 </java>
162         </target>
163
164         <!-- Only rerun the code generator if plug-in xml or jars are newer than generated java file. -->
165         <uptodate property="needsNoRegenerate" targetfile="${java.dir}/net/sf/jabref/plugin/core/generated/_JabRefPlugin.java">
166                 <srcfiles dir=".">
167                         <include name="${plugin.dir}/**/plugin.xml" />
168                         <include name="${lib.dir}/plugin/*.jar" />
169                 </srcfiles>
170         </uptodate>
171
172         <!-- Run the JPF Code Generator -->
173         <target name="generate" unless="needsNoRegenerate">
174                 <java classname="net.sf.jabref.plugin.util.CodeGenerator" fork="true">
175                         <arg value="${plugin.dir}" />
176                         <classpath refid="codegenerator" />
177                 </java>
178         </target>
179
180         <!-- Compiles project excluding tests -->
181         <target name="compile" depends="generate">
182                 <mkdir dir="${build.classes}" />
183                 <javac debug="on" deprecation="on" destdir="${build.classes}" source="1.5" target="1.5">
184                         <src path="${java.dir}" />
185                         <exclude name="tests/**" />
186                         <exclude name="**/JabRefMain.java" />
187                         <classpath refid="classpath" />
188                 </javac>
189                 <javac debug="off" deprecation="on" destdir="${build.classes}" source="1.4" target="1.4">
190                         <src path="${java.dir}" />
191                         <include name="**/JabRefMain.java" />
192                 </javac>
193         </target>
194
195         <!-- Compiles project including tests -->
196         <target name="compiletest">
197                 <mkdir dir="${build.classes}" />
198                 <javac debug="on" destdir="${build.classes}" source="1.5" target="1.5">
199                         <src path="${java.dir}" />
200                         <include name="tests/**" />
201                         <classpath refid="classpathTest" />
202                 </javac>
203         </target>
204
205         <!-- Builds the OSXAdapter -->
206         <target name="osx">
207                 <mkdir dir="${build.classes}" />
208
209                 <javac srcdir="${osx.dir}" debug="off" destdir="${build.classes}" target="1.5">
210                 </javac>
211         </target>
212
213         <!-- Copies in the OSXAdapter class, which is compilable only on Mac  -->
214         <target name="non_osx">
215                 <mkdir dir="${build.osx}" />
216                 <copy file="${lib.dir}/OSXAdapter.class" todir="${build.osx}" />
217         </target>
218
219         <!-- Jars up project -->
220         <target name="jars" depends="build, unjarlib">
221                 <mkdir dir="${build.lib}" />
222                 <mkdir dir="${build.tmp}" />
223                 <jar destfile="${build.lib}/${build.jar}">
224
225                         <fileset dir="${build.classes}" />
226                         <fileset dir="${build.tmp}" />
227                         <fileset dir="${build.dir}">
228                                 <include name="images/**" />
229                                 <include name="help/**" />
230                                 <include name="help/de/**" />
231                                 <include name="help/no/**" />
232                                 <include name="resource/**" />
233                         </fileset>
234
235                         <!-- Add Plugins -->
236                         <fileset dir="${src.dir}">
237                                 <include name="plugins/**" />
238                         </fileset>
239
240                         <fileset dir="${lib.dir}">
241                                 <include name="EndNote.zip" />
242                         </fileset>
243                         <fileset dir="${txt.dir}">
244                                 <include name="gpl.txt" />
245                                 <include name="lesser.txt" />
246                                 <include name="jgoodies.txt" />
247                                 <include name="README" />
248                         </fileset>
249                         <manifest>
250                                 <attribute name="Main-Class" value="net.sf.jabref.JabRefMain" />
251                         </manifest>
252                 </jar>
253
254         </target>
255
256         <!-- copy all necessary files and insert version informations -->
257         <target name="build" depends="compile, buildinfos" description="Build project">
258
259                 <mkdir dir="${build.resource}" />
260
261                 <copy todir="${build.resource}">
262                         <fileset dir="${resource.dir}">
263                                 <include name="**" />
264                         </fileset>
265                 </copy>
266                 <mkdir dir="${build.images}" />
267                 <copy todir="${build.images}">
268                         <fileset dir="${images.dir}">
269                                 <include name="**" />
270                         </fileset>
271                 </copy>
272
273                 <mkdir dir="${build.help}" />
274                 <copy todir="${build.help}">
275                         <fileset dir="${help.dir}" />
276                 </copy>
277
278                 <!-- Insert version informations -->
279                 <replace dir="${build.help}" token="${jabref.placeholder.version}" value="${jabref.version}">
280                         <include name="**/About.html" />
281                 </replace>
282                 <replace dir="${build.openoffice.meta}" token="${jabref.placeholder.version}" value="${jabref.version}">
283                         <include name="meta.xml" />
284                 </replace>
285
286         </target>
287
288         <!-- Prepare for testing -->
289         <target name="buildtest" depends="build, compiletest" description="Build project for testing">
290
291                 <mkdir dir="${build.tests}" />
292                 <copy todir="${build.tests}">
293                         <fileset dir="${tests.dir}">
294                                 <include name="**" />
295                         </fileset>
296                 </copy>
297         </target>
298
299         <!-- generate and save some build infos !!! necessary for dynamic build infos !!! -->
300         <!-- todo : replace it by the replace task :-),
301           src/resource/build.properties = template
302           build/resource/build.properties = real info file
303         -->
304         <target name="buildinfos">
305                 <tstamp />
306                 <!-- get date -->
307                 <buildnumber />
308                 <!-- generate new build number -> build.number -->
309                 <echo message="build number = ${build.number}" />
310                 <!-- write the file, please do not edit this lines -->
311                 <echo file="${resource.dir}/build.properties">builddate=${TODAY}
312 build=${build.number}
313 version=${jabref.version}</echo>
314         </target>
315
316
317         <!-- Creates all docs -->
318         <target name="docs" depends="javadocs" description="Generates all the documentation" />
319
320         <!-- Creates javadocs -->
321         <target name="javadocs" depends="compile" description="Generates the javadocs">
322                 <mkdir dir="${build.javadocs}" />
323                 <javadoc sourcepath="${java.dir}" destdir="${build.javadocs}" author="true" version="true" windowtitle="JabRef API" link="http://java.sun.com/j2se/1.4.1/docs/api/">
324
325                         <fileset dir="${java.dir}" defaultexcludes="yes">
326                                 <include name="**/*.java" />
327                         </fileset>
328
329                         <classpath refid="classpath" />
330                 </javadoc>
331         </target>
332
333         <!-- Creates javadocs for the extensions -->
334         <target name="extension-javadocs" depends="build" description="Generates the javadocs for the extensions archive">
335                 <mkdir dir="${build.extension-javadocs}" />
336                 <copy todir="${build.extension-javadocs}">
337                         <fileset dir="${help.dir}" defaultexcludes="yes">
338                                 <include name="CustomExports.html" />
339                                 <include name="CustomImports.html" />
340                         </fileset>
341                 </copy>
342
343                 <javadoc sourcepath="${java.dir}" destdir="${build.extension-javadocs}" author="true" version="true" windowtitle="JabRef-Extensions API" link="http://java.sun.com/j2se/1.4.1/docs/api/" Overview="${extensions.dir}/API/overview.html" access="protected">
344                         <!-- 
345                  create javadoc only selectively for classes that 
346                  users extending JabRef are likely to use
347               -->
348                         <fileset dir="${java.dir}" defaultexcludes="yes">
349                                 <include name="net/sf/jabref/imports/ImportFormat.java" />
350                                 <include name="net/sf/jabref/imports/ImportFormatReader.java" />
351                                 <include name="net/sf/jabref/BibtexEntry.java" />
352                                 <include name="net/sf/jabref/BibtexEntryType.java" />
353                                 <include name="net/sf/jabref/AuthorList.java" />
354                                 <include name="net/sf/jabref/AuthorList.java" />
355                                 <include name="net/sf/jabref/export/layout/LayoutFormatter.java" />
356                         </fileset>
357
358                         <classpath refid="classpath" />
359                 </javadoc>
360         </target>
361
362         <!-- Creates javadocs for the extensions -->
363         <target name="extensions" depends="extension-javadocs" description="Generates the extensions archive">
364                 <!-- copy examples -->
365                 <copy todir="${build.extensions}">
366                         <fileset dir="${java.dir}">
367                                 <include name="net/sf/jabref/export/layout/format/CurrentDate.java" />
368                                 <include name="net/sf/jabref/export/layout/format/ToLowerCase.java" />
369                                 <include name="net/sf/jabref/export/layout/format/HTMLChars.java" />
370                                 <include name="net/sf/jabref/imports/*Importer.java" />
371                         </fileset>
372                 </copy>
373                 <mkdir dir="${build.extension-layout}" />
374                 <copy todir="${build.extension-layout}">
375                         <fileset dir="${layout.dir}" />
376                 </copy>
377                 <copy todir="${build.extensions}">
378                         <fileset dir="${extensions.dir}" />
379                         <filterset>
380                                 <filter token="version" value="${jabref.version}" />
381                         </filterset>
382                 </copy>
383                 <!-- create extensions-zip file -->
384                 <zip destfile="${build.dir}/jabref-extensions.zip">
385                         <zipfileset dir="${build.extensions}" prefix="jabref-extensions" />
386                 </zip>
387         </target>
388
389         <target name="clean" depends="win.installer.clean" description="Clean project">
390                 <delete dir="${build.dir}" />
391         </target>
392
393         <!-- Unpacks jar needed jar files from lib directory into temp directory. -->
394         <target name="unjarlib" description="Unpacks jars from library">
395                 <mkdir dir="${build.tmp}" />
396                 <unjar dest="${build.tmp}">
397                         <fileset refid="jarsFileset" />
398                 </unjar>
399                 <delete dir="${build.tmp}/META-INF" />
400                 <!-- rename the microba license file -->
401                 <move file="${build.tmp}/license.txt" tofile="${build.tmp}/microba-license.txt" />
402         </target>
403
404
405         <target name="osxjar">
406                 <jarbundler dir="${build.lib}" name="JabRef" mainclass="net.sf.jabref.JabRef" jars="${build.lib}/${build.jar}" icon="${images.dir}/JabRef-Logo.icns" version="${jabref.version}" jvmversion="1.4+" stubfile="${lib.dir}/JavaApplicationStub" />
407         </target>
408
409
410         <!--++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->
411         <!-- Build Windows Installer                                                    -->
412         <!--                                                                            -->
413         <!-- Don't forget to set nsis.executable property                               -->
414         <!--++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->
415
416         <target name="win.installer.clean" description="Delete Installer and Exe-Wrapper + Temp-files">
417                 <delete failonerror="false" dir="${win.installer.dir}/dist" />
418                 <delete file="${win.installer.dir}/JabRefSetup.exe" />
419         </target>
420
421         <target name="win.installer" description="Copy files in place to be used by the installer" depends="jars">
422
423                 <fail unless="is.windows" message="Not running on windows or NSIS not found. Please make sure that user.properties exists" />
424
425                 <!-- Gather everything that will go into the installer in dist -->
426                 <mkdir dir="${win.installer.dir}/dist" />
427
428                 <copy file="${build.lib}/${build.jar}" todir="${win.installer.dir}/dist" />
429
430                 <available property="win.installer.jar.available" file="${win.installer.dir}/dist/${build.jar}" />
431
432                 <fail unless="win.installer.jar.available" message="Did not find jar: ${build.jar}" />
433
434                 <copy todir="${win.installer.dir}/dist">
435                         <fileset dir="${txt.dir}">
436                                 <include name="gpl.txt" />
437                                 <include name="lesser.txt" />
438                                 <include name="README" />
439                         </fileset>
440                 </copy>
441
442                 <!-- "Create Exe-Wrapper" -->
443                 <exec dir="." executable="${nsis.executable}" failonerror="true">
444                   <arg line="'/DJARFILE=${build.jar}' '/DVERSION=${jabref.version}' '/DAPPICON=../../../${images.dir}/JabRef.ico' ${win.installer.dir}/launcher.nsi" />
445                 </exec>
446
447                 <!-- Finally create Windows-Installer -->
448                 <exec dir="." executable="${nsis.executable}" failonerror="true">
449                         <arg line="'/DVERSION=${jabref.version}' ${win.installer.dir}/setup.nsi" />
450                 </exec>
451
452                 <delete dir="${win.installer.dir}/dist" />
453
454         </target>
455
456         <target name="win.installer.linux" description="Copy files in place to be used by the installer" depends="jars">
457
458                 <!-- Gather everything that will go into the installer in dist -->
459                 <mkdir dir="${win.installer.dir}/dist" />
460
461                 <copy file="${build.lib}/${build.jar}" todir="${win.installer.dir}/dist" />
462
463                 <available property="win.installer.jar.available" file="${win.installer.dir}/dist/${build.jar}" />
464
465                 <fail unless="win.installer.jar.available" message="Did not find jar: ${build.jar}" />
466
467                 <copy todir="${win.installer.dir}/dist">
468                         <fileset dir="${txt.dir}">
469                                 <include name="gpl.txt" />
470                                 <include name="lesser.txt" />
471                                 <include name="README" />
472                         </fileset>
473                 </copy>
474
475                 <!-- "Create Exe-Wrapper" -->
476                 <exec dir="." executable="${nsis.executable.linux}" failonerror="true">
477                   <arg line="'-DJARFILE=${build.jar}' '-DVERSION=${jabref.version}' '-DAPPICON=../../../${images.dir}/JabRef.ico' ${win.installer.dir}/launcher.nsi" />
478                 </exec>
479
480                 <!-- Finally create Windows-Installer -->
481                 <exec dir="." executable="${nsis.executable.linux}" failonerror="true">
482                         <arg line="'-DVERSION=${jabref.version}' ${win.installer.dir}/setup.nsi" />
483                 </exec>
484
485                 <delete dir="${win.installer.dir}/dist" />
486
487         </target>
488
489         <target name="test" depends="buildtest" description="Runs all unit tests">
490                 <java fork="yes" classname="junit.textui.TestRunner" failonerror="true">
491                         <arg value="tests.net.sf.jabref.AllTests" />
492                         <classpath refid="classpathTest" />
493                 </java>
494         </target>
495
496
497         <!--+++++++++++++++++++++++++++++++++++++++++++++++++
498            Auxiliary targets
499           +++++++++++++++++++++++++++++++++++++++++++++++++-->
500
501         <target name="profile" depends="jars" description="Profile JabRef">
502                 <fail unless="netbeans.home">This target can only run inside the NetBeans IDE.</fail>
503
504                 <nbprofiledirect>
505                         <classpath refid="classpath" />
506                 </nbprofiledirect>
507
508                 <property environment="env" />
509                 <java fork="true" classname="net.sf.jabref.JabRef" dir="${build.dir}" jvm="${profiler.info.jvm}">
510                         <jvmarg value="${profiler.info.jvmargs.agent}" />
511                         <jvmarg line="${profiler.info.jvmargs}" />
512                         <env key="LD_LIBRARY_PATH" path="${profiler.info.agentpath}:${env.LD_LIBRARY_PATH}" />
513                         <classpath refid="classpath" />
514                 </java>
515         </target>
516
517         <!--++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
518         What's about the software design ?!;-)
519     ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->
520
521         <target name="pmd" description="SOFTWAREDESIGN: Project Mess Detector !;-)">
522                 <echo>Checking Project Mess Detection (PMD) rulesets.</echo>
523                 <taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask">
524                         <classpath>
525                                 <pathelement path="${classpath}" />
526                                 <fileset dir="${lib.dir}">
527                                         <include name="*.jar" />
528                                 </fileset>
529                         </classpath>
530                 </taskdef>
531                 <!-- allowed Pretty Much Done rulsets -->
532                 <!-- rulesets/basic.xml -->
533                 <!-- rulesets/braces.xml -->
534                 <!-- rulesets/codesize.xml-->
535                 <!-- rulesets/controversial.xml-->
536                 <!-- rulesets/coupling.xml-->
537                 <!-- rulesets/design.xml -->
538                 <!-- rulesets/experimental.xml -->
539                 <!-- rulesets/favorites.xml -->
540                 <!-- rulesets/imports.xml -->
541                 <!-- rulesets/naming.xml -->
542                 <!-- rulesets/javabean.xml -->
543                 <!-- rulesets/junit.xml -->
544                 <!-- rulesets/scratchpad.xml -->
545                 <!-- rulesets/strictexception.xml -->
546                 <!-- rulesets/strings.xml -->
547                 <!-- rulesets/unusedcode.xml -->
548
549                 <pmd rulesetfiles="rulesets/unusedcode.xml,rulesets/basic.xml" failonerror="no">
550                         <formatter type="html" toFile="${build.dir}/pmd_report.html" />
551                         <fileset dir="${src.dir}">
552                                 <include name="**/*.java" />
553                         </fileset>
554                 </pmd>
555
556                 <!-- check for duplicated code -->
557                 <echo>WARNING: use environment variable: ANT_OPTS=-Xmx512m or this task will fail.</echo>
558                 <echo>Checking for duplicated code using the Copy/Paste Detector (CPD).</echo>
559                 <taskdef name="cpd" classname="net.sourceforge.pmd.cpd.CPDTask">
560                         <classpath>
561                                 <pathelement path="${classpath}" />
562                                 <fileset dir="${lib.dir}">
563                                         <include name="*.jar" />
564                                 </fileset>
565                         </classpath>
566                 </taskdef>
567                 <cpd format="text" minimumTokenCount="100" outputFile="${build.dir}/duplicated_code_report.txt">
568                         <fileset dir="${src.dir}">
569                                 <include name="**/*.java" />
570                         </fileset>
571                 </cpd>
572         </target>
573
574
575         <target name="javancss" description="SOFTWAREDESIGN: Determining the NCSS and CCN code metrics for JOELib.">
576                 <taskdef name="javancss" classname="javancss.JavancssAntTask">
577                         <classpath>
578                                 <pathelement path="${classpath}" />
579                                 <fileset dir="${lib.dir}">
580                                         <include name="*.jar" />
581                                 </fileset>
582                         </classpath>
583                 </taskdef>
584                 <echo>Cyclomatic
585 Complexity             Ease of       Risk
586 Number (CCN)           maintenance
587 (McCabe metric)
588 ---------------------------------------------
589 1-10, simple           easy          minimum
590 11-20, complex         moderate      moderate
591 21-50, more complex    hard          high
592 >50, unstable          very hard     very high
593
594 </echo>
595                 <javancss srcdir="${src.dir}" includes="**/*.java" excludes="jama/**/*.java, jmat/**/*.java, cformat/**/*.java" abortOnFail="false" ccnPerFuncMax="30" generateReport="true" outputfile="${build.dir}/javancss_report.plain" format="plain" packageMetrics="true" classMetrics="false" functionMetrics="false" />
596         </target>
597
598         <target name="jalopy" description="SOFTWAREDESIGN: source code formatter using the JOELib convention.">
599                 <taskdef name="jalopy" classname="de.hunsicker.jalopy.plugin.ant.AntPlugin">
600                         <classpath>
601                                 <pathelement path="${classpath}" />
602                                 <fileset dir="${lib.dir}">
603                                         <include name="*.jar" />
604                                 </fileset>
605                         </classpath>
606                 </taskdef>
607                 <jalopy fileformat="unix" convention="${src.dir}/java/jalopy.format.convention.xml" history="file" historymethod="adler32" loglevel="error" threads="2" classpathref="classpath" backup="bak">
608                         <fileset dir="${src.dir}">
609                                 <include name="java/net/sf/jabref/**/*.java" />
610                         </fileset>
611                 </jalopy>
612         </target>
613
614         <taskdef name="jarbundler" classpath="${lib.dir}/jarbundler-1.4.jar" classname="com.loomcom.ant.tasks.jarbundler.JarBundler" />
615
616 </project>