ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <DDevie...@lgc.com>
Subject RE: classpath in custom task?
Date Wed, 12 Jun 2002 21:37:29 GMT
Have you tried?

  <taskdef name="createdatabase" classname="MyAntTask">
    <classpath>
      <path location="c:/myanttask/build"/>
      <fileset dir="c:/pathtomyclasses/lib">
        <include name="**/*.jar"/>
      </fileset>
    </classpath>
  </taskdef>

There are issues about using <classpath> inside <taskdef> (I believe more
related to having multiple custom tasks/types that must interact with each
other) that have been fixed in 1.5, so you might want to use it if you don't
already. --DD

-----Original Message-----
From: Jeroen Breedveld [mailto:jeroenb@x-hive.com] 
Sent: Wednesday, June 12, 2002 4:33 PM
To: ant-user@jakarta.apache.org
Subject: classpath in custom task?

Hi,

I wrote a custom task that will perform some common tasks in our development
environment. It is suppose to work like this:

  <taskdef name="createdatabase" classname="MyAntTask">
    <classpath>
      <path location="c:/myanttask/build"/>
    </classpath>
  </taskdef>

  <target name="test">
    <createdatabase name="test"/>
  </target>

The problem is that all the classes used in the class MyAntTask have to be
included in the classpath. I don't want to copy to jars to the ant dir or
set the CLASSPATH environment variable because that seems to make
maintainability more difficult. What I would like is using a path like
structure like this:

  <target name="test">
    <createdatabase name="test">
      <classpath>
        <fileset dir="c:/pathtomyclasses/lib">
          <include name="**/*.jar"/>
        </fileset>
      </classpath>
    </createdatabase>
  </target>

This can way I could also use a refid to a path like structure which was
already defined in the buildfile anyway! My question is: is this possible?
The setClasspath() should receive the path information from the
createdatabase task but what should I do with it? How do I get the VM to
load the jars in the setClasspath() function? Anyone any ideas?

thanks,

Jeroen




--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>

--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message