You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Thomas Lionel SMETS <ts...@brutele.be> on 2003/03/19 02:13:55 UTC

available task

Is there a reason why we can't use the <available /> task as a 
<property/> definiton ?


I mean, this works :
<?xml version="1.0"?>

<project basedir=".." default="echo" name="TestsForCustomer">
    <!-- Prefixes all the environment properties with the -->
    <!-- 'env.' string      -->
    <property environment="env"  />

    <!-- Only the properties located in this file can be modified -->
    <!-- to customize                                             -->
    <!-- some values to your environment                          -->
    <property resource="local.properties" />

    <target name="echo">
    <!-- Verifies if some libraries are present in the CLASSPATH -->
    <available classname="org.aspectj.tools.ajbrowser.Main"
               property="compiler.inClasspath" />
      <echo>Value for :
            root directory : ${root.dir}
            ..  scripts ...    : ${scripts.dir}
             scripts.lib.dir : ${scripts.lib.dir}
            lib.dir : ${lib.dir}
            aspect compiler in the CLASSPATH : ${compiler.inClasspath}
      </echo>
    </target>
</project>


while this doesn't

<?xml version="1.0"?>

<project basedir=".." default="echo" name="TestsForCustomer">
    <!-- Prefixes all the environment properties with the -->
    <!-- 'env.' string      -->
    <property environment="env"  />

    <!-- Only the properties located in this file can be modified -->
    <!-- to customize                                             -->
    <!-- some values to your environment                          -->
    <property resource="local.properties" />
    <!-- Verifies if some libraries are present in the CLASSPATH -->
    <available classname="org.aspectj.tools.ajbrowser.Main"
               property="compiler.inClasspath" />

    <target name="echo">
      <echo>Value for :
            root directory : ${root.dir}
            ..  scripts ...    : ${scripts.dir}
             scripts.lib.dir : ${scripts.lib.dir}
            lib.dir : ${lib.dir}
            aspect compiler in the CLASSPATH : ${compiler.inClasspath}
      </echo>
    </target>
</project>


Thanks for explaination of why the second option is not logical.

Thomas,


-- 
Thomas SMETS
SCJP2 - Brussels

http://tsmets.lautre.net


Re: available task

Posted by Stefan Bodewig <bo...@apache.org>.
On Wed, 19 Mar 2003, Thomas Lionel SMETS <ts...@brutele.be> wrote:

> Is there a reason why we can't use the <available /> task as a
> <property/> definiton ?

The real question is "Is there a reason why we can't use the
<available /> task outside of <target>".  In 1.5.x the answer is: you
can't, but there is no real reason.

As a corollary, you will be able to do it in 1.6 (or current CVS,
latest nightly builds ...).  All tasks can be used outside of targets
in the future.

Stefan