Index: trunk/netbeans/nbbuild.xml
===================================================================
--- trunk/netbeans/nbbuild.xml	(revision 8529)
+++ trunk/netbeans/nbbuild.xml	(revision 9765)
@@ -8,20 +8,16 @@
 <!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
 <!-- in the project's Project Properties dialog box.-->
-<project name="josm" default="default" basedir=".">
+<project name="josmnb" default="default" basedir=".">
     <description>Builds, tests, and runs the project josm.</description>
 
-    <property name="javacc.home" location="../tools"/>
-    <property name="mapcss.dir" location="../src/org/openstreetmap/josm/gui/mappaint/mapcss"/>
-    <!-- For Windows-specific stuff -->
-    <condition property="isWindows">
-        <os family="Windows"/>
-    </condition>
+    <import file="nbproject/build-impl.xml" as="nbimpl"/>
 
-    <import file="nbproject/build-impl.xml"/>
+    <import file="../build.xml" as="josmbase"/> <!-- import the main JOSM ant file -->
+
     <!--
 
-    There exist several targets which are by default empty and which can be 
-    used for execution of your tasks. These targets are usually executed 
-    before and after some main targets. They are: 
+    There exist several targets which are by default empty and which can be
+    used for execution of your tasks. These targets are usually executed
+    before and after some main targets. They are:
 
       -pre-init:                 called before initialization of project properties
@@ -49,10 +45,10 @@
         </target>
 
-    For list of available properties check the imported 
-    nbproject/build-impl.xml file. 
+    For list of available properties check the imported
+    nbproject/build-impl.xml file.
 
 
     Another way to customize the build is by overriding existing main targets.
-    The targets of interest are: 
+    The targets of interest are:
 
       -init-macrodef-javac:     defines macro for javac compilation
@@ -60,7 +56,6 @@
       -init-macrodef-debug:     defines macro for class debugging
       -init-macrodef-java:      defines macro for class execution
-      -do-jar-with-manifest:    JAR building (if you are using a manifest)
-      -do-jar-without-manifest: JAR building (if you are not using a manifest)
-      run:                      execution of project 
+      -do-jar:                  JAR building
+      run:                      execution of project
       -javadoc-build:           Javadoc generation
       test-report:              JUnit report generation
@@ -74,55 +69,47 @@
         </target>
 
-    Notice that the overridden target depends on the jar target and not only on 
-    the compile target as the regular run target does. Again, for a list of available 
+    Notice that the overridden target depends on the jar target and not only on
+    the compile target as the regular run target does. Again, for a list of available
     properties which you can use, check the target you are overriding in the
-    nbproject/build-impl.xml file. 
+    nbproject/build-impl.xml file.
 
     -->
-    
-    <target name="-post-compile">
-    <!-- create the REVISION file to be included in the distribution -->
-		<exec append="false" output="REVISION.XML" executable="svn" dir=".." failifexecutionfails="false">
-			<env key="LANG" value="C"/>
-			<arg value="info"/>
-			<arg value="--xml"/>
-			<arg value="."/>
-		</exec>
-		<xmlproperty file="REVISION.XML" prefix="version" keepRoot="false" collapseAttributes="true"/>
-		<delete file="REVISION.XML" />
-		<tstamp>
-			<format property="build.tstamp" pattern="yyyy-MM-dd HH:mm:ss"/>
-		</tstamp>
 
-		<property name="version.entry.commit.revision" value="UNKNOWN"/>
-		<echo file="${build.classes.dir}/REVISION">
-# automatically generated by JOSM build.xml - do not edit
-Revision: ${version.entry.commit.revision}
-Is-Local-Build: true
-Build-Date: ${build.tstamp}
-</echo>
-	</target>
+    <!--
+      ** Copy resource file required on classpath.
+    -->
+    <target name="copy-josm-resources">
+        <copy file="../CONTRIBUTION" todir="${build.classes.dir}"/>
+        <copy file="../README" todir="${build.classes.dir}"/>
+        <copy file="../LICENSE" todir="${build.classes.dir}"/>
+        <copy file="../gpl-2.0.txt" todir="${build.classes.dir}" />
+        <copy file="../gpl-3.0.txt" todir="${build.classes.dir}" />
+        <copy todir="${build.classes.dir}/images"><fileset dir="../images"/></copy>
+        <copy todir="${build.classes.dir}/data"><fileset dir="../data"/></copy>
+        <copy todir="${build.classes.dir}/styles"><fileset dir="../styles"/></copy>
+        <copy todir="${build.classes.dir}/org/openstreetmap/gui/jmapviewer/images">
+            <fileset dir="../src/org/openstreetmap/gui/jmapviewer/images"/>
+        </copy>
+    </target>
 
-    <target name="check-javacc">
-        <uptodate property="javacc.notRequired" targetfile="${mapcss.dir}/parsergen/MapCSSParser.java" >
-            <srcfiles dir="${mapcss.dir}" includes="MapCSSParser.jj"/>
-        </uptodate>
-    </target>	
-    <target name="javacc" depends="check-javacc" unless="javacc.notRequired">
-        <mkdir dir="${mapcss.dir}/parsergen"/>
-        <exec append="false" executable="java" failifexecutionfails="true">
-            <arg value="-cp"/>
-            <arg value="${javacc.home}/javacc.jar"/>
-            <arg value="javacc"/>
-            <arg value="-DEBUG_PARSER=false"/>
-            <arg value="-DEBUG_TOKEN_MANAGER=false"/>
-            <arg value="-JDK_VERSION=1.7"/>
-            <arg value="-GRAMMAR_ENCODING=UTF-8"/>
-            <arg value="-OUTPUT_DIRECTORY=${mapcss.dir}/parsergen"/>
-            <arg value="${mapcss.dir}/MapCSSParser.jj"/>
-        </exec>
+    <!--
+      ** Customize some properties used by the main JOSM ant file.
+    -->
+    <target name="set-josmbase-properties" depends="-init-project">
+        <property name="revision.dir" value="${build.classes.dir}"/>
+        <property name="proj-build.dir" location="${build.dir}/build2"/>
+        <property name="proj-classpath" location="${build.classes.dir}"/>
     </target>
-    <target name="-pre-compile" depends="javacc">
-<!--        <javacc target="${mapcss.dir}/MapCSSParser.jj" javacchome="${javacc.home}" outputdirectory="${mapcss.dir}/parsergen"/>-->
-    </target>    
+
+    <!--
+      ** Make sure properties are loaded in the right order.
+      ** E.g. ${build.dir} is set both by Netbeans and by the main JOSM ant file.
+      ** Load the Netbeans properties first, which makes the values permanent.
+    -->
+    <target name="init-josmbase" depends="-init-project, set-josmbase-properties, josmbase.init-properties"/>
+
+    <target name="-pre-compile" depends="init-josmbase, josmbase.javacc"/>
+
+    <target name="-post-compile" depends="init-josmbase, josmbase.epsg, josmbase.create-revision, copy-josm-resources"/>
+
 </project>
