New upstream beta 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: 3131 $
26              $Date: 2009-11-01 15:46:02 +0100 (Sun, 01 Nov 2009) $
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.6b2" />
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                 <attribute name="Class-Path" value="." />
252                         </manifest>
253                 </jar>
254
255         </target>
256
257         <!-- copy all necessary files and insert version informations -->
258         <target name="build" depends="compile, buildinfos" description="Build project">
259
260                 <mkdir dir="${build.resource}" />
261
262                 <copy todir="${build.resource}">
263                         <fileset dir="${resource.dir}">
264                                 <include name="**" />
265                         </fileset>
266                 </copy>
267                 <mkdir dir="${build.images}" />
268                 <copy todir="${build.images}">
269                         <fileset dir="${images.dir}">
270                                 <include name="**" />
271                         </fileset>
272                 </copy>
273
274                 <mkdir dir="${build.help}" />
275                 <copy todir="${build.help}">
276                         <fileset dir="${help.dir}" />
277                 </copy>
278
279                 <!-- Insert version informations -->
280                 <replace dir="${build.help}" token="${jabref.placeholder.version}" value="${jabref.version}">
281                         <include name="**/About.html" />
282                 </replace>
283                 <replace dir="${build.openoffice.meta}" token="${jabref.placeholder.version}" value="${jabref.version}">
284                         <include name="meta.xml" />
285                 </replace>
286
287         </target>
288
289         <!-- Prepare for testing -->
290         <target name="buildtest" depends="build, compiletest" description="Build project for testing">
291
292                 <mkdir dir="${build.tests}" />
293                 <copy todir="${build.tests}">
294                         <fileset dir="${tests.dir}">
295                                 <include name="**" />
296                         </fileset>
297                 </copy>
298         </target>
299
300         <!-- generate and save some build infos !!! necessary for dynamic build infos !!! -->
301         <!-- todo : replace it by the replace task :-),
302           src/resource/build.properties = template
303           build/resource/build.properties = real info file
304         -->
305         <target name="buildinfos">
306                 <tstamp />
307                 <!-- get date -->
308                 <buildnumber />
309                 <!-- generate new build number -> build.number -->
310                 <echo message="build number = ${build.number}" />
311                 <!-- write the file, please do not edit this lines -->
312                 <echo file="${resource.dir}/build.properties">builddate=${TODAY}
313 build=${build.number}
314 version=${jabref.version}</echo>
315         </target>
316
317
318         <!-- Creates all docs -->
319         <target name="docs" depends="javadocs" description="Generates all the documentation" />
320
321         <!-- Creates javadocs -->
322         <target name="javadocs" depends="compile" description="Generates the javadocs">
323                 <mkdir dir="${build.javadocs}" />
324                 <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/">
325
326                         <fileset dir="${java.dir}" defaultexcludes="yes">
327                                 <include name="**/*.java" />
328                         </fileset>
329
330                         <classpath refid="classpath" />
331                 </javadoc>
332         </target>
333
334         <!-- Creates javadocs for the extensions -->
335         <target name="extension-javadocs" depends="build" description="Generates the javadocs for the extensions archive">
336                 <mkdir dir="${build.extension-javadocs}" />
337                 <copy todir="${build.extension-javadocs}">
338                         <fileset dir="${help.dir}" defaultexcludes="yes">
339                                 <include name="CustomExports.html" />
340                                 <include name="CustomImports.html" />
341                         </fileset>
342                 </copy>
343
344                 <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">
345                         <!-- 
346                  create javadoc only selectively for classes that 
347                  users extending JabRef are likely to use
348               -->
349                         <fileset dir="${java.dir}" defaultexcludes="yes">
350                                 <include name="net/sf/jabref/imports/ImportFormat.java" />
351                                 <include name="net/sf/jabref/imports/ImportFormatReader.java" />
352                                 <include name="net/sf/jabref/BibtexEntry.java" />
353                                 <include name="net/sf/jabref/BibtexEntryType.java" />
354                                 <include name="net/sf/jabref/AuthorList.java" />
355                                 <include name="net/sf/jabref/AuthorList.java" />
356                                 <include name="net/sf/jabref/export/layout/LayoutFormatter.java" />
357                         </fileset>
358
359                         <classpath refid="classpath" />
360                 </javadoc>
361         </target>
362
363         <!-- Creates javadocs for the extensions -->
364         <target name="extensions" depends="extension-javadocs" description="Generates the extensions archive">
365                 <!-- copy examples -->
366                 <copy todir="${build.extensions}">
367                         <fileset dir="${java.dir}">
368                                 <include name="net/sf/jabref/export/layout/format/CurrentDate.java" />
369                                 <include name="net/sf/jabref/export/layout/format/ToLowerCase.java" />
370                                 <include name="net/sf/jabref/export/layout/format/HTMLChars.java" />
371                                 <include name="net/sf/jabref/imports/*Importer.java" />
372                         </fileset>
373                 </copy>
374                 <mkdir dir="${build.extension-layout}" />
375                 <copy todir="${build.extension-layout}">
376                         <fileset dir="${layout.dir}" />
377                 </copy>
378                 <copy todir="${build.extensions}">
379                         <fileset dir="${extensions.dir}" />
380                         <filterset>
381                                 <filter token="version" value="${jabref.version}" />
382                         </filterset>
383                 </copy>
384                 <!-- create extensions-zip file -->
385                 <zip destfile="${build.dir}/jabref-extensions.zip">
386                         <zipfileset dir="${build.extensions}" prefix="jabref-extensions" />
387                 </zip>
388         </target>
389
390         <target name="clean" depends="win.installer.clean" description="Clean project">
391                 <delete dir="${build.dir}" />
392         </target>
393
394         <!-- Unpacks jar needed jar files from lib directory into temp directory. -->
395         <target name="unjarlib" description="Unpacks jars from library">
396                 <mkdir dir="${build.tmp}" />
397                 <unjar dest="${build.tmp}">
398                         <fileset refid="jarsFileset" />
399                 </unjar>
400                 <delete dir="${build.tmp}/META-INF" />
401                 <!-- rename the microba license file -->
402                 <move file="${build.tmp}/license.txt" tofile="${build.tmp}/microba-license.txt" />
403         </target>
404
405
406         <target name="osxjar">
407                 <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" />
408         </target>
409
410
411         <!--++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->
412         <!-- Build Windows Installer                                                    -->
413         <!--                                                                            -->
414         <!-- Don't forget to set nsis.executable property                               -->
415         <!--++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->
416
417         <target name="win.installer.clean" description="Delete Installer and Exe-Wrapper + Temp-files">
418                 <delete failonerror="false" dir="${win.installer.dir}/dist" />
419                 <delete file="${win.installer.dir}/JabRefSetup.exe" />
420         </target>
421
422         <target name="win.installer" description="Copy files in place to be used by the installer" depends="jars">
423
424                 <fail unless="is.windows" message="Not running on windows or NSIS not found. Please make sure that user.properties exists" />
425
426                 <!-- Gather everything that will go into the installer in dist -->
427                 <mkdir dir="${win.installer.dir}/dist" />
428
429                 <copy file="${build.lib}/${build.jar}" todir="${win.installer.dir}/dist" />
430
431                 <available property="win.installer.jar.available" file="${win.installer.dir}/dist/${build.jar}" />
432
433                 <fail unless="win.installer.jar.available" message="Did not find jar: ${build.jar}" />
434
435                 <copy todir="${win.installer.dir}/dist">
436                         <fileset dir="${txt.dir}">
437                                 <include name="gpl.txt" />
438                                 <include name="lesser.txt" />
439                                 <include name="README" />
440                         </fileset>
441                 </copy>
442
443                 <!-- "Create Exe-Wrapper" -->
444                 <exec dir="." executable="${nsis.executable}" failonerror="true">
445                   <arg line="'/DJARFILE=${build.jar}' '/DVERSION=${jabref.version}' '/DAPPICON=../../../${images.dir}/JabRef.ico' ${win.installer.dir}/launcher.nsi" />
446                 </exec>
447
448                 <!-- Finally create Windows-Installer -->
449                 <exec dir="." executable="${nsis.executable}" failonerror="true">
450                         <arg line="'/DVERSION=${jabref.version}' ${win.installer.dir}/setup.nsi" />
451                 </exec>
452
453                 <delete dir="${win.installer.dir}/dist" />
454
455         </target>
456
457         <target name="win.installer.linux" description="Copy files in place to be used by the installer" depends="jars">
458
459                 <!-- Gather everything that will go into the installer in dist -->
460                 <mkdir dir="${win.installer.dir}/dist" />
461
462                 <copy file="${build.lib}/${build.jar}" todir="${win.installer.dir}/dist" />
463
464                 <available property="win.installer.jar.available" file="${win.installer.dir}/dist/${build.jar}" />
465
466                 <fail unless="win.installer.jar.available" message="Did not find jar: ${build.jar}" />
467
468                 <copy todir="${win.installer.dir}/dist">
469                         <fileset dir="${txt.dir}">
470                                 <include name="gpl.txt" />
471                                 <include name="lesser.txt" />
472                                 <include name="README" />
473                         </fileset>
474                 </copy>
475
476                 <!-- "Create Exe-Wrapper" -->
477                 <exec dir="." executable="${nsis.executable.linux}" failonerror="true">
478                   <arg line="'-DJARFILE=${build.jar}' '-DVERSION=${jabref.version}' '-DAPPICON=../../../${images.dir}/JabRef.ico' ${win.installer.dir}/launcher.nsi" />
479                 </exec>
480
481                 <!-- Finally create Windows-Installer -->
482                 <exec dir="." executable="${nsis.executable.linux}" failonerror="true">
483                         <arg line="'-DVERSION=${jabref.version}' ${win.installer.dir}/setup.nsi" />
484                 </exec>
485
486                 <delete dir="${win.installer.dir}/dist" />
487
488         </target>
489
490         <target name="test" depends="buildtest" description="Runs all unit tests">
491                 <java fork="yes" classname="junit.textui.TestRunner" failonerror="true">
492                         <arg value="tests.net.sf.jabref.AllTests" />
493                         <classpath refid="classpathTest" />
494                 </java>
495         </target>
496
497
498         <!--+++++++++++++++++++++++++++++++++++++++++++++++++
499            Auxiliary targets
500           +++++++++++++++++++++++++++++++++++++++++++++++++-->
501
502         <target name="profile" depends="jars" description="Profile JabRef">
503                 <fail unless="netbeans.home">This target can only run inside the NetBeans IDE.</fail>
504
505                 <nbprofiledirect>
506                         <classpath refid="classpath" />
507                 </nbprofiledirect>
508
509                 <property environment="env" />
510                 <java fork="true" classname="net.sf.jabref.JabRef" dir="${build.dir}" jvm="${profiler.info.jvm}">
511                         <jvmarg value="${profiler.info.jvmargs.agent}" />
512                         <jvmarg line="${profiler.info.jvmargs}" />
513                         <env key="LD_LIBRARY_PATH" path="${profiler.info.agentpath}:${env.LD_LIBRARY_PATH}" />
514                         <classpath refid="classpath" />
515                 </java>
516         </target>
517
518         <!--++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
519         What's about the software design ?!;-)
520     ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->
521
522         <target name="pmd" description="SOFTWAREDESIGN: Project Mess Detector !;-)">
523                 <echo>Checking Project Mess Detection (PMD) rulesets.</echo>
524                 <taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask">
525                         <classpath>
526                                 <pathelement path="${classpath}" />
527                                 <fileset dir="${lib.dir}">
528                                         <include name="*.jar" />
529                                 </fileset>
530                         </classpath>
531                 </taskdef>
532                 <!-- allowed Pretty Much Done rulsets -->
533                 <!-- rulesets/basic.xml -->
534                 <!-- rulesets/braces.xml -->
535                 <!-- rulesets/codesize.xml-->
536                 <!-- rulesets/controversial.xml-->
537                 <!-- rulesets/coupling.xml-->
538                 <!-- rulesets/design.xml -->
539                 <!-- rulesets/experimental.xml -->
540                 <!-- rulesets/favorites.xml -->
541                 <!-- rulesets/imports.xml -->
542                 <!-- rulesets/naming.xml -->
543                 <!-- rulesets/javabean.xml -->
544                 <!-- rulesets/junit.xml -->
545                 <!-- rulesets/scratchpad.xml -->
546                 <!-- rulesets/strictexception.xml -->
547                 <!-- rulesets/strings.xml -->
548                 <!-- rulesets/unusedcode.xml -->
549
550                 <pmd rulesetfiles="rulesets/unusedcode.xml,rulesets/basic.xml" failonerror="no">
551                         <formatter type="html" toFile="${build.dir}/pmd_report.html" />
552                         <fileset dir="${src.dir}">
553                                 <include name="**/*.java" />
554                         </fileset>
555                 </pmd>
556
557                 <!-- check for duplicated code -->
558                 <echo>WARNING: use environment variable: ANT_OPTS=-Xmx512m or this task will fail.</echo>
559                 <echo>Checking for duplicated code using the Copy/Paste Detector (CPD).</echo>
560                 <taskdef name="cpd" classname="net.sourceforge.pmd.cpd.CPDTask">
561                         <classpath>
562                                 <pathelement path="${classpath}" />
563                                 <fileset dir="${lib.dir}">
564                                         <include name="*.jar" />
565                                 </fileset>
566                         </classpath>
567                 </taskdef>
568                 <cpd format="text" minimumTokenCount="100" outputFile="${build.dir}/duplicated_code_report.txt">
569                         <fileset dir="${src.dir}">
570                                 <include name="**/*.java" />
571                         </fileset>
572                 </cpd>
573         </target>
574
575
576         <target name="javancss" description="SOFTWAREDESIGN: Determining the NCSS and CCN code metrics for JOELib.">
577                 <taskdef name="javancss" classname="javancss.JavancssAntTask">
578                         <classpath>
579                                 <pathelement path="${classpath}" />
580                                 <fileset dir="${lib.dir}">
581                                         <include name="*.jar" />
582                                 </fileset>
583                         </classpath>
584                 </taskdef>
585                 <echo>Cyclomatic
586 Complexity             Ease of       Risk
587 Number (CCN)           maintenance
588 (McCabe metric)
589 ---------------------------------------------
590 1-10, simple           easy          minimum
591 11-20, complex         moderate      moderate
592 21-50, more complex    hard          high
593 >50, unstable          very hard     very high
594
595 </echo>
596                 <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" />
597         </target>
598
599         <target name="jalopy" description="SOFTWAREDESIGN: source code formatter using the JOELib convention.">
600                 <taskdef name="jalopy" classname="de.hunsicker.jalopy.plugin.ant.AntPlugin">
601                         <classpath>
602                                 <pathelement path="${classpath}" />
603                                 <fileset dir="${lib.dir}">
604                                         <include name="*.jar" />
605                                 </fileset>
606                         </classpath>
607                 </taskdef>
608                 <jalopy fileformat="unix" convention="${src.dir}/java/jalopy.format.convention.xml" history="file" historymethod="adler32" loglevel="error" threads="2" classpathref="classpath" backup="bak">
609                         <fileset dir="${src.dir}">
610                                 <include name="java/net/sf/jabref/**/*.java" />
611                         </fileset>
612                 </jalopy>
613         </target>
614
615         <taskdef name="jarbundler" classpath="${lib.dir}/jarbundler-1.4.jar" classname="com.loomcom.ant.tasks.jarbundler.JarBundler" />
616
617 </project>