Tutorial :How do you handle NetBeans generated build files?



Question:

I'm working on a project that uses NetBeans to generate the ANT build files. I come from an environment where the build file is something checked into source control, but with it being generated by the local NetBeans application, that doesn't seem correct. I'd like to add some custom targets to the build file, which I see that NetBeans has support for, but I'm concerned with making this custom and creating the need to check it in.

So, my main question for those of you out there who use NetBeans, how do you deal with the generated build files? Also, how do you automated builds on a build machine in this type of environment? Do you then have to install NetBeans on the build machine?

Thanks much.


Solution:1

Netbeans uses Ant tasks that are custom to the IDE environment, so you do need to dig into the bowels of Netbeans to extract -at a minimum- these ant tasks (they come in their own JARs IIRC).

Still if you absolutely must you can modify build.xml to add additional targets: Netbeans writes its build file in nbproject/build-impl.xml which is imported in build.xml. Effectively build.xml is nothing but a front that imports the real build script (build-impl.xml) and allows you to override or add build targets yourself.

But it is much easier to work with plain Ant and your own build script for simple compile source/docs/tests and generate JAR files than it is to keep dealing with Netbeans idiosyncrasies.


Solution:2

I usually create my own build file and create a netbeans free-form project that uses that build file. Then you can check in the build file to source control.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »