Hello every body,

Always about Jelly Fmt tag, Xdoc plugin and classloader, I am a bit confused
by Maven 1.0.2.

What is the difference between a defined Jelly Tag (extends BaseTagSupport)
and a closing tag defined in a plugin?
Please lets see a diff file between 2 plugin.jelly files:
* The first one uses Maven Tags defined in the jelly-tags Maven component. I
called them: <maven:grabClassLoader /> and <maven:unGrabClassLoader />
* The second one is the same code with a defined closing tag.

In a multiproject case, the first one produces the wanted value of the fmt
key and the other one produces ???myKey???. 

My godfeeling is that I am not in the right classloader! Is the
MavenJellyContext not handling the same classloader between a defined jelly
tag and a closing tag? Maybe is it an interaction with others plugins?

Thanks a lot for your response!

Cheers,

Vincent

The following lines are from the GrabClassLoaderTag:
    /* 
     * @see
org.apache.commons.jelly.Tag#doTag(org.apache.commons.jelly.XMLOutput)
     */
    public void doTag(XMLOutput arg0) throws MissingAttributeException,
JellyTagException {
        if (getMavenContext() == null) {
            throw new JellyTagException("The current MavenContext is
null!");
        }
        
        checkAttribute(this.resource, "include");

        ForeheadClassLoader currentClassLoader = null;
        try {
            currentClassLoader = (ForeheadClassLoader)
getMavenContext().getClassLoader();
        } catch (ClassCastException e) {
            throw new JellyTagException("The current classloader in the
MavenContext is not an instance of ForeheadClassLoader");
        }

        if (currentClassLoader == null) {
            throw new JellyTagException("No classloader found in the current
MavenContext");
        }
        
        try {
            File f = new File(this.resource);

            currentClassLoader.addURL(f.toURL());
        } catch (MalformedURLException e) {
            throw new JellyTagException("The directory to include specified
by " + getResource() + " is malformed");
        }

        ForeheadClassLoader newClassLoader = new
ForeheadClassLoader(currentClassLoader, currentClassLoader.getName() +
"_tmp");
        getMavenContext().setClassLoader(newClassLoader);
    }

> -----Original Message-----
> From: Brett Porter [mailto:[EMAIL PROTECTED]
> Sent: Sunday, May 01, 2005 8:32 AM
> To: Maven Developers List
> Cc: 'Brett Porter'; 'Arnaud HERITIER'
> Subject: Re: I18n site
> 
> Ah, I see. It was working inside the reactor for me, but not when you
> run a few projects. Because the classloader accumulates, you gather up
> other stuff, so the result never changes.
> 
> You can develop a tag that does the following:
> - grab the existing classloader
> - create a new classloader that inherits the current one
> - add URL to the classloader
> 
> and another tag that returns the old classloader. You'll see some of the
> java plugins (Eg hibernate) do something similar.
> 
> If you need a hand, let me know... I can do it pretty easily.
> 
> You mentioned your work was backwards compatible too... if so, I'm all
> for dropping it straight into the xdoc plugin as is and releasing it as
> 1.9
> 
> - Brett
> 
> Vincent Siveton wrote:
> 
> >Hi Brett,
> >
> >
> >
> >>Sorry for the really long time it took to respond.
> >>
> >>
> >
> >
> >No problem :o)
> >
> >
> >
> >
> >>I didn't feel confident about copying files into the plugin cache
> >>directory, so I investigated it more. What I suggest is placing the
> >>bundles under the project directory somewhere - perhaps xdocs, or
> >>perhaps a new directory?
> >>
> >>
> >
> >
> >Me too! But it is the only solution that I found to solve the
> multiproject
> >limitation.
> >
> >
> >
> >
> >>Anyway, if it were xdocs, the following will work:
> >>
> >>    <u:file var="f" name="${basedir}/xdocs" />
> >>    <j:set
> >>var="dummy">${context.getClassLoader().addURL(f.toURL())}</j:set>
> >>
> >>
> >
> >
> >Already tried in the past: it seems that it doesn't work with a
> multiproject
> >goal... In this case, fmt always produces this following result:
> >???myKey???
> >But works fine for a single project. Any clues?
> >It is a known issue for maven:reactor?
> >
> >Regards,
> >
> >Vincent
> >
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to