Debug and release configurations in a java netbeans project
Is it possible to have some sort of debug/release configurations that I can chose between so i can have some variables altered when compiling my project?
For example, alternate 开发者_JAVA技巧between database login variables or turn off some output debug variables.
Thanks
For Java projects in NetBeans, you can create multiple configurations. Right click the project in the Projects
window, choose Set Configuration > Customize
. In the top right of the new window, for Configuration
, choose New...
. Give the new configuration a name and click OK. Now you can set different command line switches (Arguments
) and VM Options
for the new configuration.
Any configuration that you create here you can then choose from the project's context menu (right click, select Set Configuration > MyConfig
).
This kind of configuration is easily handled via command-line -D
parameters, which should be settable in the run configurations, or via configuration files which can be selected the same way (usually cleaner, if there's a bunch of parameters).
Depending on frameworks in use there are also multiple ways to handle this.
精彩评论