How to force Netbeans 6.5 to use the nb-build.xml file instead of build.xml?

When I create a new project in Netbeans, it creates a build.xml file that it will use to compile and run the project along with other materials in the nbproject folder.

Now I want to have my own build.xml file, which I will use to compile for a server-side project. Some

+4
source share
5 answers

Go to the nbproject directory in the project directory and edit the project.properties file. Find the section that looks like this:

 # Only compile against the classpath explicitly listed here: build.sysclasspath=ignore build.test.classes.dir=${build.dir}/test/classes build.test.results.dir=${build.dir}/test/results 

and add the line:

 buildfile=nb-build.xml 

The next time you start the project in NetBeans, it will create a new file of this name and begin to ignore the existing build.xml file.

+11
source

We solved this problem this way. Suppose your own Ant build script is called "myBuild.xml" and is placed in the same folder as build.xml. Open the build.xml file and replace its contents with:

 <?xml version="1.0" encoding="UTF-8"?> <project name="payroll_web_ice_jq" default="default" basedir="."> <condition property="import.path" value="myBuild.xml"> <not><isset property="netbeans.user"/></not> </condition> <condition property="import.path" value="nbproject/build-impl.xml"> <isset property="netbeans.user"/> </condition> <!-- conditional import. If triggered from NetBeans, use old build script if triggered from shell, user new build script --> <import file="${import.path}" /> </project> 

As you can see, we are checking for the existence of the netbeans.user property, which should exist only in Netbeans and not on the command line. It works for us.

+3
source

When creating a project, you can choose a Java project option with existing sources or a web project with existing sources. I believe that this will respect any existing build.xml file and create a secondary assembly file.

There is also an option when creating a project to use an existing script assembly, however, I believe that this option will not generate a Netbeans build script for you, instead it will rely solely on the existing script assembly for all buildings.

+1
source

Try to remove the import statement in the build.xml file for the created NetBeans build-impl.xml (i.e. <import file="nbproject/build-impl.xml"/> ) and replace it with your nb-build.xml import (for example , <import file="nb-build.xml"/> )

0
source

Source: https://habr.com/ru/post/1286286/


All Articles