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