Если вы выберете File > Project Properties > Build > Packaging
, вы увидите диалоговое окно, позволяющее исключить артефакты из сборки; все остальное дерево исходных текстов включено. Источник TreeIconDemo
является конкретным примером, включающим html
файлы.
Для более сложных задач изучите значение по умолчанию build.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
Приложение: В качестве примера эта цель переопределяет -post-compile
для печати некоторой статистики.
<project name="TreeIconDemo" default="default" basedir=".">
<import file="nbproject/build-impl.xml"/>
<target name="-post-compile">
<echo>build.dir: ${build.dir}</echo>
<length mode="all" property="build.size">
<fileset dir="${build.dir}">
<include name="**/*"/>
</fileset>
</length>
<echo>build.size: ${build.size}</echo>
</target>
</project>
Выход:
$ ant compile
Buildfile: build.xml
...
-post-compile:
[echo] build.dir: build
[echo] build.size: 11992
compile:
BUILD SUCCESSFUL