开发者

How do I get the target as a property in Ant?

开发者 https://www.devze.com 2023-01-19 16:24 出处:网络
Possibly 开发者_如何转开发one of those really terrible beginner questions where the manual will tell you everything, but, anyway, take this line below:

Possibly 开发者_如何转开发one of those really terrible beginner questions where the manual will tell you everything, but, anyway, take this line below:

ant -Dfoo=bar buildme

in my build script, what is the property that holds "buildme"?


The list of targets invoked is available in the property

ant.project.invoked-targets

If there is a default target specified, then that will be the invoked target. If one or more targets are specified on the command line, these appear comma-separated in the property. Note that the property only becomes set once execution passes to a target - if you try to read the property outside of any target, it will be unset.

So, if the project has a default target 'zero':

$ ant one two
# ant.project.invoked-targets is set to:
one,two

and

$ ant
# ant.project.invoked-targets is set to (default):
zero


Seems like ant.project.invoked-targets is not available in ant 1.7.1


Not sure I understand your question, but "buildme" is the target to execute, not a property.

ant [options] [target [target2 [target3] ...]]

You "pick it" by creating the corresponding target:

<target name="buildme">
  <!-- tasks that will execute here -->
</target>

As for the foo property, you "pick it" by using ${foo}.

0

精彩评论

暂无评论...
验证码 换一张
取 消