2014-10-27 69 views
5

我从7.0.1更新到Netbeans 8.0.1,如果'Web Start'被禁用,我的java程序编译得很好。只要 'Web Start的' 启用我收到以下错误:Netbeans蚂蚁生成错误'不支持的元素定制'

C:\NetBeansProjects\SearchCriteriaEditor\nbproject\jnlp-impl.xml:480: 
unsupported element customize 
  • 在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>

的修复,据我所知:'添加以下自定义junit宏定义:'

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

麻烦是我不知道那里是什么,也没有以任何方式修改我的蚂蚁文件...任何人都可以给我多一点信息?我假定修补程序在jnlp-impl.xml文件中的某处;我只是不知道该把它放在哪里。

编辑更新:增加所有部分与引用 'copylibs' 在JNLP-impl.xml中的文件 -

<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> 

在此先感谢。

回答

2

<j2seproject3:copylibs调用名称空间前缀为j2seproject3的宏定义copylibs。应该有构建文件一个地方copylibs宏被定义,在某种程度上类似(但不一定是精确的),以:

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

上面行应逻辑上-init-macrodef-copylibs目标内部存在的,这是其中也应定义元素customize。以下是基于我拥有的示例NetBeans项目的片段。内容可能不完全匹配你有一个,所以把我的答案用一粒盐:

<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> 
+0

嗨manouti,对不起,是一个痛苦..有用于copylibs没有macrodef。我已将nlp-impl.xml中copylibs的所有引用添加到原始问题中。我是否需要将其添加到文件中? – Robbie62 2014-11-19 05:55:47

+0

@ Robbie62肯定在某处存在'copylibs'的定义。它可能位于由'jnlp-impl.xml'导入的另一个Ant构建文件中吗? – manouti 2014-11-19 17:36:08

+0

嗨manouti,是的,还有另一个我完全忘记了的构建文件。我目前正在进行Google Startup挑战,因此直到几天后我才能够回到它。 – Robbie62 2014-11-23 04:16:51