Building a Project from Outside of the IDE


Because the IDE's project commands are based on Ant scripts and properties files, you can run these targets from outside of the IDE.

Assuming that you have Ant installed on your system, you simply can call the build.xml file or one of its targets from the command line by changing directories to the directory holding build.xml and typing ant.

If your project uses optional Ant tasks that are defined within the IDE, you might need to do some manual configuration. For example, if you have a target that depends on JUnit, you need to place the JUnit binary in your Ant classpath.

Setting up a Headless Build Environment

If you have a large nested project structure that you want to run from outside of the IDE, such as when you are doing production builds of your application, you will probably need to make some adjustments to set up headless builds.

Following are the tasks you need to perform:

  • Set up Ant (version 1.6 or higher) on your system. You can either download Ant or use the Ant JAR file that is included with the IDE (NBHome/ide6/ant/lib/ant.jar in the IDE's installation directory). Visit http://ant.apache.org/ to download or get more information on Ant. NetBeans IDE 5.0 is bundled with Ant version 1.6.5, so any standard projects you set up will use that version. Also, make sure the command-line version of Ant you are using is running from the same version of the Java platform that your project is using.

  • Make JUnit available to Ant. You can do this by adding the JUnit JAR file to AntHome/lib. You can use the IDE's copy of JUnit, which is located in NBHome/ide6/modules/ext and is named according to version number. (In NetBeans IDE 5.0, for example, it is junit3.8.1.jar.)

  • Make sure any libraries the IDE uses when building your project are accessible from the build script that the build machine uses. These libraries are specified in the build.properties file located in your IDE user directory. You can find the IDE's user directory by choosing Help | About, clicking the Detail tab, and looking at the User Dir value.



NetBeans IDE Field Guide(c) Developing Desktop, Web, Enterprise, and Mobile Applications
NetBeans IDE Field Guide(c) Developing Desktop, Web, Enterprise, and Mobile Applications
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 279

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net