[prev in list] [next in list] [prev in thread] [next in thread]
List: maven-user
Subject: Re: What is maven/jelly equivalent of ant's antcall?
From: Colin Sampaleanu <colinml1 () exis ! com>
Date: 2003-01-31 14:26:33
[Download RAW message or body]
James,
Thanks for the info. I picked up on both of these. Using a tag is
preferred since it can take params. The problem is that (as I reported
in another message which I'll quote below, when I define a custom tag
(basically the same as in your example) the maven context seems to be
available when you are in a pregoal (and presumably a goal), but not
when you are in the custom tag itself. I was going to try to dig a bit
deeper into this, but it requires running maven in a debugger or looking
at stuff a lot more closely, and I haven't had time yet.
-----
If is use something like:
<path id="mypath1" location="${basedir}/one"/>
<path id="mypath2" location="${basedir}/two"/>
<maven:addPath id="mypath1" refid="mypath2"/>
in a preGoal, it works fine. But if I use jelly:define:tag to define a
custom tag called let's say 'my:tag", which contains the same lines as
above, and in the preGoal at the same location invoke <my:tag>, I get a
ClassCastException at
at
org.apache.maven.jelly.tags.BaseTagSupport.getMavenContext(BaseTagSupport.java:72)
at
org.apache.maven.jelly.tags.maven.AddPathTag.doTag(AddPathTag.java:92)
at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:278)
at
org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:133)
at
org.apache.commons.jelly.impl.DynamicTag.doTag(DynamicTag.java:112)
...
from which all I can conclude is that the context being found is a base
JellyContext, not a MavenJellyContext.
Can anybody explain what is going on? I have tried defining the tag
itself as a child of <project> in maven.xml, and also to test, as a
child of <preGoal>, with no difference in behaviour. I was trying to do
this to investigate using custom tags as subroutine/macro mechanisms.
-----
James Strachan wrote:
>To define simple blocks of repeatable code, you can use the simple
><define:script> and <define:invoke> tags.
>
>e.g.
>
><define:script var="myScript">
> ... do something here ...
></define:script>
>
>... then much later...
>
><define:invoke script="${myScript}"/>
>
>
>If you want much more control and to parameterize the blocks, you can define
>a new tag library with one or more new tags in their own namespace then use
>normal XML attributes to customize the blocks.
>
>e.g.
>
><project xmlns:j="jelly:core"
> xmlns:my="myLibrary">
>
><define:taglib uri="myLibrary">
> <define:tag name="foo">
> <echo>invoked with a = ${a}</echo>
> </define:tag>
> ...
></define:taglib>
>
>Then to invoke your 'subroutine' (your tag) maybe parameterizing it
>somewhat...
>
> <my:foo a="${123-2}"/>
>
>which would output
>
> invoked with a = 121
>
>
>So there's simple scripts you can just invoke, or more well defined tags
>(optionally with attribute validation) which you can define with Jelly
>script and invoke with parameterized values.
>
>James
>-------
>http://radio.weblogs.com/0112098/
>----- Original Message -----
>From: "Colin Sampaleanu" <colinml1@exis.com>
>To: "Turbine Maven Users List" <turbine-maven-user@jakarta.apache.org>
>Sent: Wednesday, January 29, 2003 7:51 PM
>Subject: What is maven/jelly equivalent of ant's antcall?
>
>
>
>
>>Ant's antcall task is sometimes used to do 'subroutine' style calls into
>>other targets from one or more locations within an ant build file. To
>>some extent this is not too clean since it mixes up usage of targets as
>>run due to dependencies vs. targets run as subroutines, but it does
>>work. I am trying to figure out the best way to do something similar in
>>Maven/Jelly.
>>
>>One way I can think that should work is to use Jelly's define:tag tag to
>>define a new tag for the funtionality I need, and then just use that tag
>>appropriately... Another way would be to use jeez:target to wrap a goal,
>>and then use antcall to call it.
>>
>>Anybody have any suggestions on the best way to do this?
>>
>>
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-maven-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-maven-user-help@jakarta.apache.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic