2009-12-02 41 views
0

我有了这条线在它Ant构建:转换../在路径中的Ant

WORKSPACE.dir = ${basedir}/../

我然后有:

CORE_PROJECT.dir= ${WORKSPACE.dir}/UUI_Core

这意味着我结束与这样的路径:

C:\dev\workspaces\RTC\UUI_Core_ANT/..//UUI_Core

在几乎所有情况下都可以正常工作,但我正在尝试构建要在构建中使用的类的列表。目前,我有这样的代码:

<pathconvert 
    property="coreClasses" 
    pathsep=" " 
    dirsep="." 
    refid="coreSources"> 
    <map from="C:\dev\workspaces\RTC\UUI_Core\src\" to="" /> 
    <mapper> 
     <chainedmapper> 
      <globmapper from="*.mxml" to="*"/> 
     </chainedmapper> 
     <chainedmapper> 
      <globmapper from="*.as" to="*"/> 
     </chainedmapper> 
    </mapper> 
</pathconvert> 

这样做的作用是移除文件位置和jsut离开包结构。虽然这不是很灵活。我应该可以在这里使用CORE_PROJECT.dir。

所以,我怎么能转换

C:\dev\workspaces\RTC\UUI_Core_ANT/..//UUI_Core

C:\dev\workspaces\RTC\UUI_Core

回答

6
WORKSPACE.dir = ${basedir}/../ 

这不是一个有效的Ant语法。

要转换..您应该使用<property>任务的location属性而不是valuelocation用绝对路径替代属性值。你的情况:

<property name="WORKSPACE.dir" location="${basedir}/.."/> 

编辑:我应该设置路径类似属性时添加,总是使用location属性。