2011-06-15 98 views
1

這裏是我的構建文件:無法識別workspaceid在Ant4Eclipse

<project name="ant-in-eclipse" basedir="." 
     xmlns:ant4eclipse="antlib:org.ant4eclipse" 
     xmlns:antcontrib="antlib:net.sf.antcontrib" default="compileAndJar" > 

    <taskdef uri="antlib:net.sf.antcontrib" 
      resource="net/sf/antcontrib/antlib.xml" /> 

    <!-- define ant4eclipse tasks --> 
    <taskdef uri="antlib:org.ant4eclipse" 
      resource="org/ant4eclipse/ant/antlib.xml" /> 

    <import file="/data/temp/ANT/ANT4/macros/a4e-jdt-macros.xml"/> 
    <target name="compileAndJar"> 
     <macrodef name="build"> 
      <attribute name="workspaceDirectory" default="deploy" /> 
      <sequential> 
       <echo>Hi</echo> 
      </sequential> 
     </macrodef> 

     <buildJdtProject workspaceDirectory="${workspaceDirectory}" 
         projectname="wfn-common.jar"> 
     <finish> 
      <jar destfile="deploy/wfn-common.jar"> 
       <ant4eclipse:jdtProjectFileSet destination="." 
       projectname="${buildJdtProject.project.name}" /> 
      </jar> 
     </finish> 
     </buildJdtProject> 
    </target> 
</project> 

我收到此錯誤

/data/temp/ANT/PTO_Build/WFN_Framework/wfn-common/sample.xml:21: The following error occurred while executing this line: 
/data/temp/ANT/ANT4/macros/a4e-jdt-macros.xml:105: ant4eclipse:executeJdtProject doesn't support the "workspaceid" attribute 
    at org.apache.tools.ant.RuntimeConfigurable.maybeConfigure(RuntimeConfigurable.java:396) 
    at org.apache.tools.ant.RuntimeConfigurable.maybeConfigure(RuntimeConfigurable.java:344) 
    at org.apache.tools.ant.Task.maybeConfigure(Task.java:202) 
    at org.apache.tools.ant.UnknownElement.configure(UnknownElement.java:196) 
    at org.apache.tools.ant.UnknownElement.maybeConfigure(UnknownElement.java:163) 
    at org.apache.tools.ant.Task.perform(Task.java:347) 
    at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68) 
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) 
    at java.lang.reflect.Method.invoke(Method.java:600) 
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) 
    at org.apache.tools.ant.Task.perform(Task.java:348) 
    at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:398) 
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) 
    at java.lang.reflect.Method.invoke(Method.java:600) 
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) 
    at org.apache.tools.ant.Task.perform(Task.java:348) 
    at org.apache.tools.ant.Target.execute(Target.java:390) 
    at org.apache.tools.ant.Target.performTasks(Target.java:411) 
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399) 
    at org.apache.tools.ant.Project.executeTarget(Project.java:1368) 
    at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) 
    at org.apache.tools.ant.Project.executeTargets(Project.java:1251) 
    at org.apache.tools.ant.Main.runBuild(Main.java:809) 
    at org.apache.tools.ant.Main.startAnt(Main.java:217) 
    at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280) 
    at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109) 
Caused by: ant4eclipse:executeJdtProject doesn't support the "workspaceid" attribute. 
    at org.ant4eclipse.ant.jdt.containerargs.JdtClasspathContainerArgumentDelegate.setDynamicAttribute(JdtClasspathContainerArgumentDelegate.java:70) 
    at org.ant4eclipse.ant.jdt.AbstractExecuteJdtProjectTask.setDynamicAttribute(AbstractExecuteJdtProjectTask.java:63) 
    at org.apache.tools.ant.IntrospectionHelper.setAttribute(IntrospectionHelper.java:394) 
    at org.apache.tools.ant.RuntimeConfigurable.maybeConfigure(RuntimeConfigurable.java:388) 
    ... 31 more 

任何人都可以請幫我嗎?

回答

1

的錯誤是在文件中導入:

<進口 文件= 「/數據/溫度/ ANT/ANT4 /宏/ A4E-JDT-macros.xml」/>

我想你的buildJDTProject目標是在那裏定義的,並且它是如何定義的錯誤。

  • 看看這個文件/data/temp/ANT/ANT4/macros/a4e-jdt-macros.xml
  • 看行105,這是你的構建失敗

我猜測它會在buildJDTProject目標。我猜這個目標包含workspaceid屬性,這似乎是非法的。

您可以刪除該屬性,或者找出它爲什麼包含在第一位。也許它適用於你的ant jdt庫的不同版本?

兩個進一步的猜測(我不熟悉ant4eclipse順便說一句)。關於buildJdtProject任務ant4eclipse的...

文件稱

是 'workspaceDirectory' 或 'workspaceId' 必須指定

你傳入workspaceDirectory目標在你的建立腳本。可能workspaceId默認情況下在該導入文件的宏中指定。如果是這樣,也許你最終定義了workspaceDirectoryworkspaceId,這是非法的。但是,該想法與您收到的錯誤消息不符。

或者,也許ant4eclipse區分屬性名稱。對於Ant來說這是不尋常的,它通常不區分大小寫。但是ant4eclipse文檔給出的屬性名稱爲workspaceId,並且您的錯誤消息說不支持workspaceid。所以也許試着改變那個導入的文件中的情況。

+0

你能告訴我什麼是正確的方法來在這裏進行。 – NareshKumar 2011-06-15 11:39:27

+0

我已經添加了一些建議 – sudocode 2011-06-15 14:24:15