Using Headless Builds


Because the IDE's project commands are based on Ant scripts and properties files, you can run these targets from outside of the IDE as "headless builds." Headless builds for Mobility projects operate under the same principles as for general Java projects. See Chapter 3, Deploying a Java Project Outside of the IDE for more information.

Computers with NetBeans IDE

Assuming that the project has already been opened in NetBeans on the target computer and no reference problems exist, any Ant target can be invoked from within the project directory. For example, typing ant jar run at a command line will compile, package, and execute the project.

As always, Ant properties can be set by using the -D switch. Examine your project's build.properties file to see which properties can be set. Normally, this is used to activate a certain configuration. For example, the following line will run the project using the BigScreenConfig:

ant-Dconfig.active=BigScreenConfig run


Computers without NetBeans IDE

Running NetBeans projects on computers that have no NetBeans IDE installation is somewhat more complicated. It is strongly recommended that projects be opened within NetBeans IDE, as then the IDE can be used to configure the project to work on the new machine. But if this is not possible, you should take the following actions to set up the project:

  • You must have access to the Mobility Ant Library, as described in Using Ant in Mobility Projects earlier in this chapter.

  • Create a /private subdirectory in nbproject containing a file called private.properties. This file should match the properties file located in the NetBeans user's /private directory for the same project. Update the hard path references to refer to local locations.

  • Create a build.properties file somewhere on the local machine. This file should be similar to the one located on the NetBeans user's {user home}/build.properties file. It should contain all properties (with correct path information) that refer to libraries or emulator platforms used by the project in question.

Once these files have been created, the headless build can be invoked similarly to how it is started on machines with NetBeans installed. The only difference is that the user.properties.file should be set to point to the build.properties file created previously. So, for example,

ant-Duser.properties.file=C:\{path}\build.properties jar


will build the distribution JAR files of the project. Make sure to use a fully qualified path to the build.properties file.



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