Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Netbeans ant build error 'unsupported element customize'

Tags:

java

ant

netbeans

I updated to Netbeans 8.0.1 from 7.0.1 and my java program compiles fine if 'Web Start' is disabled. As soon as 'Web Start' is enabled I get the following error:

C:\NetBeansProjects\SearchCriteriaEditor\nbproject\jnlp-impl.xml:480: 
unsupported element customize
  • in this section of the jnlp-impl.xml file:

    <target name="-do-jar-jnlp-application" depends="-init-filename,-test-jnlp-type,-init-macrodef-copylibs" if="is.application+mkdist.available"> <j2seproject3:copylibs manifest="${tmp.manifest.file}"> <customize> <attribute name="Main-Class" value="${main.class}"/> </customize> </j2seproject3:copylibs> <echo>To run this application from the command line without Ant, try:</echo> <property location="${jnlp.dest.dir}/${jnlp.file}" name="jnlp.file.resolved"/> <echo>javaws "${jnlp.file.resolved}"</echo> </target>

The fix, as I understand it is to: 'add following to customized junit macro definition:'

<attribute default="" name="testmethods"/>
   <element name="customize" optional="true"/>
<customize/>

Trouble is I have no idea where that is, nor have I modified my ant file in any way...can anyone give me a bit more information? I assume the fix goes somewhere in the jnlp-impl.xml file; I just have no idea where to put it.

Edit update: added all sections with references to 'copylibs' in the jnlp-impl.xml file-

<target name="-test-jnlp-type" depends="-test-jnlp-enabled" if="is.jnlp.enabled">
    <condition property="is.applet">
        <equals arg1="${jnlp.descriptor}" arg2="applet" trim="true"/>
    </condition>
    <condition property="is.application">
        <equals arg1="${jnlp.descriptor}" arg2="application" trim="true"/>
    </condition>
    <condition property="is.component">
        <equals arg1="${jnlp.descriptor}" arg2="component" trim="true"/>
    </condition>
    <condition property="is.applet+mkdist.available">
        <and>
            <isset property="libs.CopyLibs.classpath"/>
            <istrue value="${is.applet}"/>
        </and>
    </condition>
    <condition property="is.application+mkdist.available">
        <and>
            <isset property="libs.CopyLibs.classpath"/>
            <istrue value="${is.application}"/>
        </and>
    </condition>
    <condition property="is.component+mkdist.available">
        <and>
            <isset property="libs.CopyLibs.classpath"/>
            <istrue value="${is.component}"/>
        </and>
    </condition>
</target>

......

<target name="-do-jar-jnlp-application" depends="-init-filename,-test-jnlp-type,-init-macrodef-copylibs" if="is.application+mkdist.available">
    <j2seproject3:copylibs manifest="${tmp.manifest.file}">
        <customize>
            <attribute name="Main-Class" value="${main.class}"/>
        </customize>
    </j2seproject3:copylibs>
    <echo>To run this application from the command line without Ant, try:</echo>
    <property location="${jnlp.dest.dir}/${jnlp.file}" name="jnlp.file.resolved"/>
    <echo>javaws "${jnlp.file.resolved}"</echo>
</target>
<target name="-do-jar-jnlp-component" depends="-test-jnlp-type,-init-macrodef-copylibs" if="is.component+mkdist.available">
    <j2seproject3:copylibs manifest="${tmp.manifest.file}"/>
</target>

Thanks in advance.

like image 211
Robbie62 Avatar asked Nov 01 '22 15:11

Robbie62


1 Answers

<j2seproject3:copylibs invokes the macrodef copylibs with the namespace prefix j2seproject3. There should be a place in the buildfile where the copylibs macro is defined, in a way similar (but not necessarily exact) to:

<macrodef name="copylibs" uri="http://www.netbeans.org/ns/j2se-project/3">

The above line should logically exist inside the -init-macrodef-copylibs target, and this is where the customize element should be defined as well. Below is the snippet based on a sample NetBeans project I have. The content will probably not match exactly the one you have, so take my answer with a grain of salt:

<macrodef name="copylibs" uri="http://www.netbeans.org/ns/j2se-project/3">
    ... <!-- some attributes may be defined here first -->
    <element name="customize" optional="true"/>  <!-- customize should be defined here -->
    <sequential>
        ...
        <!-- somewhere in the macrodef -->
        <copylibs compress="${jar.compress}" index="${jar.index}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
            <fileset dir="${build.classes.dir}"/>
            <manifest>
                <attribute name="Class-Path" value="${jar.classpath}"/>
                <customize/>    <!-- this is where customize is used -->  
            </manifest>
         </copylibs>
         ...
    </sequential>
</macrodef>
like image 147
M A Avatar answered Nov 09 '22 13:11

M A