task2/solution14/build.xml
author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
Wed, 01 Oct 2008 11:23:11 +0200
changeset 32 2198184978d5
parent 25 a022dd2a5d30
permissions -rw-r--r--
Task2
japod@25
     1
<?xml version="1.0" encoding="UTF-8"?>
japod@25
     2
<!-- You may freely edit this file. See commented blocks below for -->
japod@25
     3
<!-- some examples of how to customize the build. -->
japod@25
     4
<!-- (If you delete it and reopen the project it will be recreated.) -->
japod@25
     5
<project name="currency" default="default" basedir=".">
japod@25
     6
    <description>Builds, tests, and runs the project.</description>
japod@25
     7
    <import file="nbproject/build-impl.xml"/>
japod@25
     8
    <!--
japod@25
     9
japod@25
    10
    There exist several targets which are by default empty and which can be 
japod@25
    11
    used for execution of your tasks. These targets are usually executed 
japod@25
    12
    before and after some main targets. They are: 
japod@25
    13
japod@25
    14
      -pre-init:                 called before initialization of project properties
japod@25
    15
      -post-init:                called after initialization of project properties
japod@25
    16
      -pre-compile:              called before javac compilation
japod@25
    17
      -post-compile:             called after javac compilation
japod@25
    18
      -pre-compile-single:       called before javac compilation of single file
japod@25
    19
      -post-compile-single:      called after javac compilation of single file
japod@25
    20
      -pre-compile-test:         called before javac compilation of JUnit tests
japod@25
    21
      -post-compile-test:        called after javac compilation of JUnit tests
japod@25
    22
      -pre-compile-test-single:  called before javac compilation of single JUnit test
japod@25
    23
      -post-compile-test-single: called after javac compilation of single JUunit test
japod@25
    24
      -pre-jar:                  called before JAR building
japod@25
    25
      -post-jar:                 called after JAR building
japod@25
    26
      -post-clean:               called after cleaning build products
japod@25
    27
japod@25
    28
    (Targets beginning with '-' are not intended to be called on their own.)
japod@25
    29
japod@25
    30
    Example of inserting an obfuscator after compilation could look like this:
japod@25
    31
japod@25
    32
        <target name="-post-compile">
japod@25
    33
            <obfuscate>
japod@25
    34
                <fileset dir="${build.classes.dir}"/>
japod@25
    35
            </obfuscate>
japod@25
    36
        </target>
japod@25
    37
japod@25
    38
    For list of available properties check the imported 
japod@25
    39
    nbproject/build-impl.xml file. 
japod@25
    40
japod@25
    41
japod@25
    42
    Another way to customize the build is by overriding existing main targets.
japod@25
    43
    The targets of interest are: 
japod@25
    44
japod@25
    45
      -init-macrodef-javac:     defines macro for javac compilation
japod@25
    46
      -init-macrodef-junit:     defines macro for junit execution
japod@25
    47
      -init-macrodef-debug:     defines macro for class debugging
japod@25
    48
      -init-macrodef-java:      defines macro for class execution
japod@25
    49
      -do-jar-with-manifest:    JAR building (if you are using a manifest)
japod@25
    50
      -do-jar-without-manifest: JAR building (if you are not using a manifest)
japod@25
    51
      run:                      execution of project 
japod@25
    52
      -javadoc-build:           Javadoc generation
japod@25
    53
      test-report:              JUnit report generation
japod@25
    54
japod@25
    55
    An example of overriding the target for project execution could look like this:
japod@25
    56
japod@25
    57
        <target name="run" depends="currency-impl.jar">
japod@25
    58
            <exec dir="bin" executable="launcher.exe">
japod@25
    59
                <arg file="${dist.jar}"/>
japod@25
    60
            </exec>
japod@25
    61
        </target>
japod@25
    62
japod@25
    63
    Notice that the overridden target depends on the jar target and not only on 
japod@25
    64
    the compile target as the regular run target does. Again, for a list of available 
japod@25
    65
    properties which you can use, check the target you are overriding in the
japod@25
    66
    nbproject/build-impl.xml file. 
japod@25
    67
japod@25
    68
    -->
japod@25
    69
</project>