1 <?xml version="1.0" encoding="UTF-8"?>
2 <!-- You may freely edit this file. See commented blocks below for -->
3 <!-- some examples of how to customize the build. -->
4 <!-- (If you delete it and reopen the project it will be recreated.) -->
5 <!-- By default, only the Clean and Build commands use this build script. -->
6 <!-- Commands such as Run, Debug, and Test only use this build script if -->
7 <!-- the Compile on Save feature is turned off for the project. -->
8 <!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
9 <!-- in the project's Project Properties dialog box.-->
10 <project name="livedb" default="default" basedir=".">
11 <description>Builds, tests, and runs the project livedb.</description>
12 <import file="nbproject/build-impl.xml"/>
17 There exist several targets which are by default empty and which can be
18 used for execution of your tasks. These targets are usually executed
19 before and after some main targets. They are:
21 -pre-init: called before initialization of project properties
22 -post-init: called after initialization of project properties
23 -pre-compile: called before javac compilation
24 -post-compile: called after javac compilation
25 -pre-compile-single: called before javac compilation of single file
26 -post-compile-single: called after javac compilation of single file
27 -pre-compile-test: called before javac compilation of JUnit tests
28 -post-compile-test: called after javac compilation of JUnit tests
29 -pre-compile-test-single: called before javac compilation of single JUnit test
30 -post-compile-test-single: called after javac compilation of single JUunit test
31 -pre-jar: called before JAR building
32 -post-jar: called after JAR building
33 -post-clean: called after cleaning build products
35 (Targets beginning with '-' are not intended to be called on their own.)
37 Example of inserting an obfuscator after compilation could look like this:
39 <target name="-post-compile">
41 <fileset dir="${build.classes.dir}"/>
45 For list of available properties check the imported
46 nbproject/build-impl.xml file.
49 Another way to customize the build is by overriding existing main targets.
50 The targets of interest are:
52 -init-macrodef-javac: defines macro for javac compilation
53 -init-macrodef-junit: defines macro for junit execution
54 -init-macrodef-debug: defines macro for class debugging
55 -init-macrodef-java: defines macro for class execution
56 -do-jar-with-manifest: JAR building (if you are using a manifest)
57 -do-jar-without-manifest: JAR building (if you are not using a manifest)
58 run: execution of project
59 -javadoc-build: Javadoc generation
60 test-report: JUnit report generation
62 An example of overriding the target for project execution could look like this:
64 <target name="run" depends="livedb-impl.jar">
65 <exec dir="bin" executable="launcher.exe">
66 <arg file="${dist.jar}"/>
70 Notice that the overridden target depends on the jar target and not only on
71 the compile target as the regular run target does. Again, for a list of available
72 properties which you can use, check the target you are overriding in the
73 nbproject/build-impl.xml file.
77 <target name="-pre-compile-test">
78 <antcall target="create-db"/>
81 <!-- BEGIN: livedb.derby.create -->
82 <target name="-check-db">
83 <property name="db" location="build/classes/db"/>
84 <available property="db.exists" file="${db}"/>
86 <target name="create-db" unless="db.exists" depends="init,-check-db">
89 <echo message="Creating DB in ${db}"/>
90 <sql classpath="${file.reference.derby.jar}" userid="j1" password="j1"
91 url="jdbc:derby:${db};create=true"
92 driver="org.apache.derby.jdbc.EmbeddedDriver"
94 create table APP.AGE (
98 insert into APP.AGE values ('apidesign', 3);
100 <!-- don't forget to shutdown the DB -->
101 <sql classpath="${file.reference.derby.jar}" userid="j1" password="j1"
102 url="jdbc:derby:${db};shutdown=true"
103 driver="org.apache.derby.jdbc.EmbeddedDriver"
105 errorproperty="ignore.error"
106 failonconnectionerror="false"
108 <echo message="DB created OK."/>
110 <!-- END: livedb.derby.create -->