Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
342 lines (285 sloc) 15.7 KB
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See commented blocks below for -->
<!-- some examples of how to customize the build. -->
<!-- (If you delete it and reopen the project it will be recreated.) -->
<project name="jAER" default="default" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant">
<description>Builds, tests, and runs the project jAER</description>
<import file="nbproject/build-impl.xml"/>
There exist several targets which are by default empty and which can be
used for execution of your tasks. These targets are usually executed
before and after some main targets. They are:
-pre-init: called before initialization of project properties
-post-init: called after initialization of project properties
-pre-compile: called before javac compilation
-post-compile: called after javac compilation
-pre-compile-single: called before javac compilation of single file
-post-compile-single: called after javac compilation of single file
-pre-compile-test: called before javac compilation of JUnit tests
-post-compile-test: called after javac compilation of JUnit tests
-pre-compile-test-single: called before javac compilation of single JUnit test
-post-compile-test-single: called after javac compilation of single JUunit test
-pre-jar: called before JAR building
-post-jar: called after JAR building
-post-clean: called after cleaning build products
(Targets beginning with '-' are not intended to be called on their own.)
Example of inserting an obfuscator after compilation could look like this:
<target name="-post-compile">
<fileset dir="${build.classes.dir}"/>
For list of available properties check the imported
nbproject/build-impl.xml file.
Another way to customize the build is by overriding existing main targets.
The targets of interest are:
-init-macrodef-javac: defines macro for javac compilation
-init-macrodef-junit: defines macro for junit execution
-init-macrodef-debug: defines macro for class debugging
-init-macrodef-java: defines macro for class execution
-do-jar-with-manifest: JAR building (if you are using a manifest)
-do-jar-without-manifest: JAR building (if you are not using a manifest)
run: execution of project
-javadoc-build: Javadoc generation
test-report: JUnit report generation
An example of overriding the target for project execution could look like this:
<target name="run" depends="usb2aemon-impl.jar">
<exec dir="bin" executable="launcher.exe">
<arg file="${dist.jar}"/>
Notice that the overridden target depends on the jar target and not only on
the compile target as the regular run target does. Again, for a list of available
properties which you can use, check the target you are overriding in the
nbproject/build-impl.xml file.
<!-- override clean to not delete dist dir, because this messes up svn -->
<target name="-do-clean" depends="init,clean-ivy">
<delete dir="${build.dir}"/>
see ivy.xml
<target name="retrieve-dependencies"
description="Retrieve dependencies with Apache IVY">
<ivy:retrieve type="jar" />
<path id="ivy.lib.path">
<fileset dir="jars" includes="ivy-2.4.0.jar"/>
<taskdef resource="org/apache/ivy/ant/antlib.xml"
uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/>
<target name="-ivy-cleancache">
<ivy:cleancache />
<target name="-ivy-retrieve">
<ivy:retrieve/> Load dependencies to the project
<pathconvert property="ivy.classpath.computed" dirsep="/" pathsep=":">
<fileset dir="lib" includes="*.jar"/>
<map from="${basedir}${file.separator}" to=""/>
<propertyfile file="nbproject/">
<entry operation="=" key="ivy.classpath" value="${ivy.classpath.computed}"/>
<!-- <target name="-pre-compile" depends="-ivy-retrieve"/>-->
<!-- <target name="-post-clean">
<delete dir="lib"/>
<!--ivy download and configure, from -->
<property name="ivy.install.version" value="2.4.0" />
<property name="ivy.jar.dir" value="${basedir}/ivy" />
<property name="ivy.cache.dir" value="${basedir}/ivy" />
<property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar" />
<property name="ivy.lib" value="${basedir}/lib" />
<property name="ivy.settings.location" value="${basedir}/ivysettings.xml" />
<target name="-check-ivy">
<available file="${ivy.jar.file}" property=""/>
<target name="-download-ivy" unless="" depends="-check-ivy">
<mkdir dir="${ivy.jar.dir}"/>
<echo message="installing ivy..."/>
<get src="${ivy.install.version}/ivy-${ivy.install.version}.jar"
dest="${ivy.jar.file}" usetimestamp="true"/>
<target name="-load-ivy-tasks" depends="-download-ivy">
<path id="ivy.lib.path">
<pathelement location="${ivy.jar.file}"/>
<taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/>
<target name="download-deps" depends="-load-ivy-tasks"
description="Download dependent libraries.">
<pathconvert property="ivy.classpath.computed" dirsep="/" pathsep=":">
<fileset dir="${ivy.lib}" includes="*.jar"/>
<map from="${basedir}${file.separator}" to=""/>
<propertyfile file="${basedir}/nbproject/">
<entry operation="=" key="ivy.classpath" value="${ivy.classpath.computed}"/>
<target name="clean-deps" description="Clean downloaded libraries.">
<delete dir="${ivy.lib}"/>
<target name="clean-ivy" depends="clean-deps" description="Clean ivy.">
<!--<delete dir="${ivy.jar.dir}"/>-->
<propertyfile file="${basedir}/nbproject/">
<entry operation="=" key="ivy.classpath" value=""/>
<target name="-use-ivy-junit" depends="download-deps" unless="netbeans.home">
<property name="libs.junit_4.classpath" value="${ivy.lib}/junit-4.10.jar"/>
<target name="-pre-compile" depends="download-deps"/>
<target name="-pre-compile-single" depends="download-deps"/>
<target name="-pre-init" depends="-use-ivy-junit">
<!-- makes sure that the build version is written to the jar -->
<target name="-pre-jar" depends="jaer-setBuildVersion,jaer-copySplashImage" >
<echo message="build.xml project opened"/>
<echo> Having trouble building or running?
See the jAER user forum at!forum/jaer-users
<target name="checkos">
<condition property="isWindows" value="true">
<os family="windows" />
<!-- copy splash image to src tree so that it gets into main jar-->
<target name="jaer-copySplashImage">
<copy file="images/SplashScreen.gif" todir="build/classes"/>
<!-- The exe4j launcher target to build jAERViewer.exe with integrated java 6 splash screen.
<target name="jaer-exe4j">
<echo message="Building Windows .exe. launchers using exe4j ( ${line.separator} Note that depending on 32- or 64-bit installed JDKs, ${line.separator} you may not be able to build one or the other of these launchers. ${line.separator} Don't worry about this."/>
<!-- <subant failonerror="false" target="jaer-exe4jx86">
<fileset dir="." includes="build.xml"/>
<subant failonerror="false" target="jaer-exe4jx64">
<fileset dir="." includes="build.xml"/>
Your license key for exe4j 4.x is:
<!-- <target name="jaer-exe4jx86" depends="checkos" if="isWindows" >
<echo message="Building jaer-exe4j jAERViewer.exe 32-bit Windows launcher for 32-bit Java Virtual Machines - embedding ico and setting SplashScreen in jAERViewer.exe. ${line.separator} Don't worry if this task fails for you unless you have changed the classpath. ${line.separator}jAERViewer.exe does not normally need to be rebuilt."/>
<taskdef name="jaer-exe4j" classname="com.jaer-exe4j.Exe4JTask" classpath="exe4j-launcher/exe4j_x86/bin/ant.jar" onerror="ignore" />
<exe4j projectfile="jaer1.5_win_jre_x86.exe4j" requirelicense="true"/>
<target name="jaer-exe4jx64" depends="checkos" if="isWindows">
<echo message="Building exe4j jAERViewer.exe 64-bit Windows launcher for 64-bit Java Virtual Machines - embedding icon and setting SplashScreen in jAERViewer.exe. ${line.separator} Don't worry if this task fails for you unless you have changed the classpath. ${line.separator}jAERViewer.exe does not normally need to be rebuilt."/>
<taskdef name="exe4j" classname="com.exe4j.Exe4JTask" classpath="exe4j-launcher/exe4j_x64/bin/ant.jar" onerror="report"/>
<exe4j projectfile="jaer_win_jre_x64.exe4j" requirelicense="true"/>
<!-- builds the windows executable .exe launcher files -->
<target name="-post-jar" depends="jaer-exe4j">
<!-- builds a zip of all the javadoc -->
<target name="jaer-archive-javadoc" depends="javadoc">
<delete file="../../jaer-javadoc-*.zip" />
<property name="javadocZipFileName" value="../../jaer-javadoc-${DSTAMP}.zip" />
<zip destfile="${javadocZipFileName}" comment="jAER javadoc ${DSTAMP} - see">
<zipfileset prefix="jAER-javadoc" dir="${dist.javadoc.dir}" />
<!-- builds a runtime archive for end users who don't want to develop -->
<target name="jaer-runtime-archive" depends="jar">
<delete file="../../jaer-runtime-*.zip" />
<property name="runtimeZipFileName" value="../../jaer-runtime-${DSTAMP}.zip"/>
<zip destfile="${runtimeZipFileName}" level="9"
comment="jAER runtime release ${DSTAMP}- see h">
<zipfileset prefix="jAER-runtime"
**/*.private, **/*.hprof, **/*.log, **/*.ncb"
<target name="jaer-runtime-release-upload" >
<fileset file="../../jaer-runtime-${DSTAMP}.zip"/>
<target name="javadoc-ftp" depends="javadoc">
<ftp server="" remotedir="upload" binary="true" userid="anonymous" password="jaer-project">
<fileset dir="${dist.dir}">
<include name="" />
<!-- scp the javadoc to the project web pages at sourceforge.
This uses a private key file and trusts the host explicitly. The SF username is prompted for and then all javadoc is uploaded.
The link to the generated javadoc is
The key can be generated under linux with ssh-keygen -t dsa
and then must be uploaded via SF's key managment system.
<target name="jaer-javadoc-upload" depends="init">
<echo message="first run javadoc-archive target to build javadoc and zip archive of javadoc"/>
<input message="SourceForge username?" addproperty="javadoc.upload.username"/>
<!-- <input message="SourceForge password?" addproperty="javadoc.upload.password"/> -->
<fileset dir="${dist.dir}/javadoc" />
<!-- builds a file with the output of svnversion that is used for the About dialogs -->
<!--TODO fix to get rev info from git-->
<target name="jaer-setBuildVersion" depends="init">
<echo message="Making build version file ${buildversion.outputfile} - you can ignore any error ${line.separator}generated here since it will only affect the Help/About... dialog." />
<delete file="${buildversion.outputfile}"/>
<echo message="Built ${TODAY} at ${TSTAMP} by ${}${line.separator}" append="true" file="${buildversion.outputfile}" />
<echo message="${}${line.separator}" append="true" file="${buildversion.outputfile}" />
<echo message="os.version=${os.version}${line.separator}" append="true" file="${buildversion.outputfile}" />
<echo message="java.version=${java.version}${line.separator}" append="true" file="${buildversion.outputfile}" />
<echo message="java.vendor=${java.vendor}${line.separator}" append="true" file="${buildversion.outputfile}" />
<echo message="&quot;:git describe&quot; output: " append="true" file="${buildversion.outputfile}" />
<!-- run version command to get revision numnber -->
<exec executable="git" failifexecutionfails="false" spawn="false" dir="${basedir}" output="${buildversion.outputfile}" append="true" searchpath="true">
<arg line="describe"/>
<echo message="${line.separator}" append="true" file="${buildversion.outputfile}" />
<filelist dir="${basedir}" files="${buildversion.outputfile}"/>
<target name="jaer-sign-jar" depends="jar">
<echo message="Self-signing jar"/>
<signjar jar="${dist.jar}" alias="jaer" keystore="keystore" storepass="jaerjaer"/>
You can’t perform that action at this time.