蚂蚁 - 如何设置$ {} ant.project.name项目文件夹名称? [英] Ant - How to set ${ant.project.name} to project folder name?

查看:162
本文介绍了蚂蚁 - 如何设置$ {} ant.project.name项目文件夹名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何设置$ {} ant.project.name价值?我想将其设置为:
$ {} ant.project.name = $ {BASEDIR}

How to set ${ant.project.name} value? I want to set it as: ${ant.project.name}=${basedir}

我不想设定从build.xml文件的项目名称。我的想法是 - 它应该自动把文件夹的名称

I don't want to set the project name from build.xml. My idea is - it should take the name of the folder automatically.

这可能吗?

推荐答案

在Ant属性的 ant.project.name 用于返回出现在您的构建文件顶部的字符串。它具有特殊的意义,实在不应该被改变。

The ANT property ant.project.name is designed to return the string that appears at the top of your build file. It has special meaning and shouldn't really be changed.

下面的例子演示如何使用替代性(这应该在Windows上工作以及):

The following example demonstrates how you could use an alternative property (This should work on windows as well):

<project name="demo" default="run">

    <basename property="my.project.name" file="${basedir}"/>

    <target name="run">
        <echo message="ant.project.name=${ant.project.name}"/>
        <echo message="my.project.name=${my.project.name}"/>
    </target>

</project>

有以下输出

run:
     [echo] ant.project.name=demo
     [echo] my.project.name=myprojectdirname

这篇关于蚂蚁 - 如何设置$ {} ant.project.name项目文件夹名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆