diff --git a/docs/faq.html b/docs/faq.html index 56afbd929..2d77aff39 100644 --- a/docs/faq.html +++ b/docs/faq.html @@ -239,6 +239,10 @@
  • How do I use jar's M switch? I don't want a MANIFEST. +
  • +
  • + How can I do something like <property name="prop" + value="${${anotherprop}}"/> (double expanding the property)?
  • It doesn't work (as expected)

    @@ -254,8 +258,8 @@
  • I have a target I want to skip if a property is set, - so I have unless="property" as an attribute - of the target, but all the targets this target + so I have unless="property" as an attribute + of the target, but all the targets this target depends on are still executed. Why?
  • @@ -340,13 +344,13 @@ Where do I find the latest version of this document?

    -

    The latest version can always be found at Ant's homepage +

    The latest version can always be found at Ant's homepage http://ant.apache.org/faq.html.

    How can I contribute to this FAQ?

    -

    The page you are looking it is generated from +

    The page you are looking it is generated from this document. If you want to add a new question, please submit a patch against this document to one of Ant's mailing lists; @@ -359,7 +363,7 @@ How do you create the HTML version of this FAQ?

    -

    We use +

    We use Anakia to render the HTML version from the original XML file.

    The Velocity stylesheets used to process the XML files can @@ -386,7 +390,7 @@

    According to Ant's original author, James Duncan Davidson, the name is an acronym for "Another Neat Tool".

    -

    Later explanations go along the lines of "ants +

    Later explanations go along the lines of "ants do an extremely good job at building things", or "ants are very small and can carry a weight dozens of times their own" - describing what Ant is intended to @@ -747,7 +751,7 @@ shell-prompt> m4 foo.m4 > foo to determine the specific state you want to test for.

    To see how this works, assume you have three properties: prop1, prop2, and prop3. - You want to test that prop1 and prop2 + You want to test that prop1 and prop2 are set, and that prop3 is not. If the condition holds true you want to echo "yes".

    Here is the implementation in Ant 1.3 and earlier:

    @@ -811,8 +815,8 @@ shell-prompt> m4 foo.m4 > foo

    Because testing for a literal ${property} string isn't all that readable or easy to understand, - post-1.4.1 Ant introduces the <isset> element - to the <condition> task.

    + post-1.4.1 Ant introduces the <isset> element + to the <condition> task.

    Here is the previous example done using <isset>:

    @@ -866,6 +870,21 @@ shell-prompt> m4 foo.m4 > foo
             <zip> uses your platforms default encoding.
             Use the encoding attribute of <zip> if
             necessary.

    +

    + + How can I do something like <property name="prop" + value="${${anotherprop}}"/> (double expanding the property)? +

    +

    Without any external help you can not.

    +

    With <script/>, which needs external libraries, you can do

    +
    +<script language="javascript">
    +    propname = project.getProperty("anotherprop");
    +    project.setNewProperty("prop", propname);
    +</script>
    +
    +

    With AntContrib (external task library) you can do + <propertycopy name="prop" from="${anotherprop}"/>.

    Why does Ant always recompile all my Java files? @@ -924,23 +943,23 @@ shell-prompt> m4 foo.m4 > foo

    I have a target I want to skip if a property is set, - so I have unless="property" as an attribute - of the target, but all the targets this target + so I have unless="property" as an attribute + of the target, but all the targets this target depends on are still executed. Why?

    The list of dependencies is generated by Ant before any of the - targets are run. This allows dependent targets, such as an - init target, to set properties that can control the - execution of the targets higher in the dependency graph. This - is a good thing.

    + targets are run. This allows dependent targets, such as an + init target, to set properties that can control the + execution of the targets higher in the dependency graph. This + is a good thing.

    However, when your dependencies break down the higher-level task - into several smaller steps, this behaviour becomes + into several smaller steps, this behaviour becomes counter-intuitive. There are a couple of solutions available:

    1. Put the same condition on each of the dependent targets.
    2. - +
    3. Execute the steps using <antcall>, instead of specifying them inside the depends attribute.
    4. @@ -962,10 +981,10 @@ shell-prompt> m4 foo.m4 > foo elements only apply to the file list produced by the <include> elements.

      To get the files you want, focus on just the - <include> patterns that would be necessary - to get them. If you find you need to trim the list that the - <include> elements produce, then use - <exclude> elements.

      + <include> patterns that would be necessary + to get them. If you find you need to trim the list that the + <include> elements produce, then use + <exclude> elements.

      ant failed to build my program via javac @@ -1002,7 +1021,7 @@ shell-prompt> m4 foo.m4 > foo Is Ant supported by my IDE/Editor?

      -

      See the section +

      See the section on IDE integration on our External Tools and Tasks page.

      @@ -1019,10 +1038,10 @@ shell-prompt> m4 foo.m4 > foo .antrc (contributed by Ville Skyttä).

       # Detect (X)Emacs compile mode
      -if [ "$EMACS" = "t" ] ; then 
      -  ANT_ARGS="$ANT_ARGS -emacs" 
      -  ANT_OPTS="$ANT_OPTS -Dbuild.compiler.emacs=true" 
      -fi 
      +if [ "$EMACS" = "t" ] ; then
      +  ANT_ARGS="$ANT_ARGS -emacs"
      +  ANT_OPTS="$ANT_OPTS -Dbuild.compiler.emacs=true"
      +fi
       

      Alternatively, you can add the following snippet to your .emacs to make Emacs understand Ant's @@ -1030,10 +1049,10 @@ fi

       (require 'compile)
       (setq compilation-error-regexp-alist
      -  (append (list 
      +  (append (list
            ;; works for jikes
            '("^\\s-*\\[[^]]*\\]\\s-*\\(.+\\):\\([0-9]+\\):\\([0-9]+\\):[0-9]+:[0-9]+:" 1 2 3)
      -     ;; works for javac 
      +     ;; works for javac
            '("^\\s-*\\[[^]]*\\]\\s-*\\(.+\\):\\([0-9]+\\):" 1 2))
         compilation-error-regexp-alist))
       
      @@ -1049,16 +1068,16 @@ fi # $|=1; while(<STDIN>) { - if (s/^(\s+)\[(\w+)\]//) { - if ($2 ne $last) { - print "$1\[$2\]"; - $s = ' ' x length($2); - } else { - print "$1 $s "; - }; - $last = $2; - }; - print; + if (s/^(\s+)\[(\w+)\]//) { + if ($2 ne $last) { + print "$1\[$2\]"; + $s = ' ' x length($2); + } else { + print "$1 $s "; + }; + $last = $2; + }; + print; };

    @@ -1072,7 +1091,7 @@ while(<STDIN>) {