You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Stefan Bodewig <bo...@apache.org> on 2004/04/14 16:49:53 UTC

[Jelly] Lessons from Gump part 3: Ant tags should set ant.file

Ant isn't in the very best shape for being embedded, it assumes it has
been invoked via the command line in various places.

One of the things that have changed between Ant 1.5.x and 1.6.0 is
that <ant> and friends now check whether they are part of a circular
invocation by comparing the current build file location with the one
of the file they are supposed to call.  This new code assumed that
ant.file has been set.

Actually, in the context of Jelly the value doesn't matter at all, so
you could set it to something arbitrary.  I've chosen to use the
String form of JellyContext#getCurrentURL in my patch, but you may
want to use something different.

A patch like the appended patch is necessary to make Jelly work with
Ant 1.6.0 and 1.6.1 - Ant 1.6.2 (no release scheduled yet) will work
with Jelly as it is.

Stefan

Index: src/java/org/apache/commons/jelly/tags/ant/AntTagLibrary.java
===================================================================
RCS file: /home/cvspublic/jakarta-commons/jelly/jelly-tags/ant/src/java/org/apache/commons/jelly/tags/ant/AntTagLibrary.java,v
retrieving revision 1.29
diff -u -r1.29 AntTagLibrary.java
--- src/java/org/apache/commons/jelly/tags/ant/AntTagLibrary.java	25 Feb 2004 01:23:59 -0000	1.29
+++ src/java/org/apache/commons/jelly/tags/ant/AntTagLibrary.java	14 Apr 2004 14:49:10 -0000
@@ -134,6 +134,8 @@
         
         project.init();
         project.getBaseDir();
+        project.setProperty("ant.file", 
+                            context.getCurrentURL().toExternalForm());
 
         return project;
     }

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [Jelly] Lessons from Gump part 3: Ant tags should set ant.file

Posted by di...@multitask.com.au.
Stefan Bodewig <bo...@apache.org> wrote on 15/04/2004 12:49:53 AM:

> Ant isn't in the very best shape for being embedded, it assumes it has
> been invoked via the command line in various places.
> 
> One of the things that have changed between Ant 1.5.x and 1.6.0 is
> that <ant> and friends now check whether they are part of a circular
> invocation by comparing the current build file location with the one
> of the file they are supposed to call.  This new code assumed that
> ant.file has been set.
[snip]

Cool,

I've committed the change.
--
dIon Gillard, Multitask Consulting