[英]Netbeans ant build error 'unsupported element customize'
I updated to Netbeans 8.0.1 from 7.0.1 and my java program compiles fine if 'Web Start' is disabled. 我从7.0.1更新到Netbeans 8.0.1,如果禁用“Web Start”,我的java程序编译得很好。 As soon as 'Web Start' is enabled I get the following error: 一旦启用“Web Start”,我就会收到以下错误:
C:\NetBeansProjects\SearchCriteriaEditor\nbproject\jnlp-impl.xml:480:
unsupported element customize
in this section of the jnlp-impl.xml file: 在jnlp-impl.xml文件的这一部分中:
<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:' 修复,据我所知是:'添加以下自定义junit宏定义:'
<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; 我假设修复程序在jnlp-impl.xml文件中的某处; I just have no idea where to put it. 我根本不知道把它放在哪里。
Edit update: added all sections with references to 'copylibs' in the jnlp-impl.xml file- 编辑更新:在jnlp-impl.xml文件中添加了对'copylibs'的引用的所有部分 -
<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. 提前致谢。
<j2seproject3:copylibs
invokes the macrodef copylibs
with the namespace prefix j2seproject3
. <j2seproject3:copylibs
调用macrodef copylibs
通过命名空间前缀j2seproject3
。 There should be a place in the buildfile where the copylibs
macro is defined, in a way similar (but not necessarily exact) to: 构建文件中应该有一个位置,其中定义了copylibs
宏,其方式类似于(但不一定完全):
<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. 上面的行应该在-init-macrodef-copylibs
目标中逻辑上存在,这也是customize
元素的地方。 Below is the snippet based on a sample NetBeans project I have. 下面是基于我所拥有的NetBeans项目示例的代码段。 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>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.