You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Carpenter, James" <ja...@ercot.com> on 2003/12/23 01:27:40 UTC

Trouble writting Ant task that sets a path reference

Overview:
I am trying to create a custom ant task that sets up a classpath reference based on its arguments.  My problem is I am not sure how a custom task interacts with references.  My task is responsible for creating a reference rather than consuming them as is probably more typical.  Can anyone help?

Do I simply take the classpathid as a java.lang.String and then call the org.apache.tools.ant.Project's "public void addReference(String name, Object value)" method?  (I didn't know about this when I wrote the rest of the posting.)

Details:
An example usage is shown below.  The desired result is that subproject.classpath will contain a path reference that can be used in a compile task.  Each nested subproject element will result in one or more jar files being added to the subproject.classpath path reference.

The guts of the task will involve looking in several areas for the desired jars and providing deprication warnings as appropriate when there is a newer version of the internal library than is currently being used by a subproject of the overall build.  If the subprojectlibdir/category directory exists for a given nested subproject element, the jars for that subproject will be taken from that directory.  If the subprojectdir/category directory for a given nested subproject element doesn't exist then a standard directory containing internal releases for each subproject (releasedir) will be searched for a category/desiredversion directory.  In this event any category/someversion directories indicating a newer internal release (based on the naming convention for the someversion directories) will result in a deprication warning.  The deprication warnings are non-fatal and are simply intended to urge developers to move to the newest version of any internal libraries.

 <findsubprojects
            classpathid="subproject.classpath"
            subprojectlibdir="${subproject.lib.dir}"
	releasedir=${release.archive.dir}>
             <subproject
                 category="${internal.core.category}"
                 desiredversion="${internal.core.desiredversion}"/>
             <subproject
                 category="${internal.db.category}"
                 desiredversion="${internal.db.desiredversion}"/>
        </findsubprojects>

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