下午好蚂蚁路径转换
我运行蚂蚁现在我有路径属性“COM /源/项目”,以处理一些代码,但我需要通过“com.source.project”我的Java代码无论如何,我可以将“/”转换为“”。使用Ant命令
感谢
下午好蚂蚁路径转换
我运行蚂蚁现在我有路径属性“COM /源/项目”,以处理一些代码,但我需要通过“com.source.project”我的Java代码无论如何,我可以将“/”转换为“”。使用Ant命令
感谢
PropertyRegex任务为你工作,但你需要安装ant-contrib。
<project>
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="./ant-contrib-1.0b3.jar"/>
</classpath>
</taskdef>
<property name="path" value="com/source/project"/>
<echo message="Path=${path}"/>
<propertyregex property="java.package.name"
input="${path}"
regexp="/"
replace="."
global="true"
defaultValue="${path}" />
<echo message="package=${java.package.name}"/>
</project>
这是一些使用Ant Plugin Flaka的完整项目。我也不得不更换$ {} path.separator用“”启动一些Java类。见先从意见“;”
<project xmlns:fl="antlib:it.haefelinger.flaka">
<fl:install-property-handler/>
<property name="srcroot" value="path/to/srcrootdir"/>
<property name="classroot" value="path/to/classrootdir"/>
<!-- determine all main classes -->
<fileset dir="${srcroot}" includes="**/*.java" id="mainclasses">
<contains text="public static void main"/>
</fileset>
<!-- iterate over those main classes and
call the corresponding classfile -->
<fl:for var="file" in="split('${toString:mainclasses}', ';')">
<fl:let>
; strip the .java Extension
file = replace(file, '', '.java')
; replace fileseparator with '.'
; on Windows you have to use the following line
; replace(file, '\.', '${file.separator}${file.separator}')
file = replace(file, '\.', '${file.separator}')
</fl:let>
<fl:echo>
starting => #{file} in ${classroot}
</fl:echo>
<java classname="#{file}">
<classpath>
<!--
when using a fileset you'll get a
java.util.zip.ZipException because you're
referencing classfiles and no jars
therefore you have to use
pathelement and location
-->
<pathelement location="${classroot}"/>
</classpath>
</java>
</fl:for>
</project>
我把它整理自己...但是我还是谢谢你:) – Makky 2011-06-10 08:24:27
感谢队友! – Makky 2011-06-08 15:58:15