Do you inform jenkins that you have a taglibrary?

On 2 July 2014 23:34, Tom Fennelly <[email protected]> wrote:

> Hi.
>
> Just wondering if anyone can guide me as to how I can write a Java based
> TagLibrary and have it loadable from a plugin (without setting
> pluginFirstClassLoader=true).  When I try it I get a classloader exception
> that makes total sense to me, but I'm wondering if there's some trick or
> different impl that works around it.
>
> Example... a Simple TagLibrary impl like this...
>
> public class IconsTaglib extends TagLibrary {
>     public IconsTaglib() {
>
>              // Register some tags...
>
>         registerTag("*myFunkyTag*", MyFunkyTag.class);
>     }
> }
>
>
> This class is located in the plugin i.e. not in Jenkins core with other
> taglibs.
>
> Then in a .jelly tag script (also in the plugin, but for which there are
> no cloassloading issues) we use the *myFunkyTag *tag that was implemented
> in Java e.g.
>
> <myf:myFunkyTag xmlns:myf="jelly:org.jenkins.x.y.MyFunkyTag" />
>
>
> The above causes a ClassLoading exception because Jelly's XMLParser class
> (code located in Jenkins - not in the plugin) tries to load the MyFunkyTag
> class with the wrong classloader (XMLParser line #1024).  What looks like
> would work (in this specific case at least) is if XMLParser tried using the
> JellyContext ClassLoader instead, but of course that might cause other
> issues.
>
> BTW I tried with the MyFunkyTag impl located in Jenkins core and
> everything works fine as expected.
>
> Any suggestions?  I'm wondering maybe this is not an issue if I implement
> the Tag in Groovy instead, but would like to know if doing it in Java is
> not going to work first.
>
> Thanks,
>
> Tom.
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Jenkins Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to