You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

build.xml 4.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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="Phone" default="default" basedir=".">
  11. <description>Builds, tests, and runs the project Phone.</description>
  12. <import file="nbproject/build-impl.xml"/>
  13. <!--
  14. There exist several targets which are by default empty and which can be
  15. used for execution of your tasks. These targets are usually executed
  16. before and after some main targets. They are:
  17. -pre-init: called before initialization of project properties
  18. -post-init: called after initialization of project properties
  19. -pre-compile: called before javac compilation
  20. -post-compile: called after javac compilation
  21. -pre-compile-single: called before javac compilation of single file
  22. -post-compile-single: called after javac compilation of single file
  23. -pre-compile-test: called before javac compilation of JUnit tests
  24. -post-compile-test: called after javac compilation of JUnit tests
  25. -pre-compile-test-single: called before javac compilation of single JUnit test
  26. -post-compile-test-single: called after javac compilation of single JUunit test
  27. -pre-jar: called before JAR building
  28. -post-jar: called after JAR building
  29. -post-clean: called after cleaning build products
  30. (Targets beginning with '-' are not intended to be called on their own.)
  31. Example of inserting an obfuscator after compilation could look like this:
  32. <target name="-post-compile">
  33. <obfuscate>
  34. <fileset dir="${build.classes.dir}"/>
  35. </obfuscate>
  36. </target>
  37. For list of available properties check the imported
  38. nbproject/build-impl.xml file.
  39. Another way to customize the build is by overriding existing main targets.
  40. The targets of interest are:
  41. -init-macrodef-javac: defines macro for javac compilation
  42. -init-macrodef-junit: defines macro for junit execution
  43. -init-macrodef-debug: defines macro for class debugging
  44. -init-macrodef-java: defines macro for class execution
  45. -do-jar: JAR building
  46. run: execution of project
  47. -javadoc-build: Javadoc generation
  48. test-report: JUnit report generation
  49. An example of overriding the target for project execution could look like this:
  50. <target name="run" depends="Phone-impl.jar">
  51. <exec dir="bin" executable="launcher.exe">
  52. <arg file="${dist.jar}"/>
  53. </exec>
  54. </target>
  55. Notice that the overridden target depends on the jar target and not only on
  56. the compile target as the regular run target does. Again, for a list of available
  57. properties which you can use, check the target you are overriding in the
  58. nbproject/build-impl.xml file.
  59. -->
  60. <!-- Change the value to the name of the final jar without .jar -->
  61. <target name="-post-jar">
  62. <property name="store.jar.name" value="Phone"/>
  63. <property name="store.dir" value="dist"/>
  64. <property name="store.jar" value="${store.dir}/${store.jar.name}.jar"/>
  65. <echo message="Packaging ${application.title} into a single JAR at ${store.jar}"/>
  66. <jar destfile="${store.dir}/temp_final.jar" filesetmanifest="skip">
  67. <zipgroupfileset dir="dist" includes="*.jar"/>
  68. <zipgroupfileset dir="lib" includes="*.jar"/>
  69. <manifest>
  70. <attribute name="Main-Class" value="${main.class}"/>
  71. </manifest>
  72. </jar>
  73. <zip destfile="${store.jar}">
  74. <zipfileset src="${store.dir}/temp_final.jar"
  75. excludes="META-INF/*.SF, META-INF/*.DSA, META-INF/*.RSA"/>
  76. </zip>
  77. <delete file="${store.dir}/temp_final.jar"/>
  78. </target>
  79. </project>