...but what if the classpath needed to compile with changes?


I cannot keep all the libraries I use inside my project, with predictable paths from the project basedir. I do not want to change the build script every time I move software installations around, or make patches for each person who runs it.


Use <pathelement location="${some.jar}"/> or <pathelement path="${some.path}"/>. Define Ant properties giving default values for these locations that can be overridden. You can override them using -D or ~/.antrc on the command line; Ant settings in the NetBeans Options dialog; or (with or without NetBeans) using a separate properties file loaded by the script.

This last method - using a separate properties file such as ant.properties or the like - is especially recommended, which is why the standard NetBeans project types use it. When you do this method, remember that a properties file including absolute filenames should typically not be a part of source control, i.e. it is "site-local". If using Subversion, do not check it in, and add its name to the svn:ignore property for that directory (similarly for other version control systems).

Applies to: NetBeans 4.0 and later

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo