Well I suspect that you need to inform jelly of the TagLibrary class or
else it will not discover it. I am suspecting that there is a plugin goal
putting the requisite info somewhere on the classpath. That plugin goal is
probably working for jenkins core but perhaps not by default in plugins


On 3 July 2014 09:56, Tom Fennelly <[email protected]> wrote:

>  xmlns:myf="jelly:org.jenkins.x.y.MyFunkyTag" is one way of doing that
> and, as I said, that works when the TagLibrary impl is located in Jenkins
> core (Vs out in a plugin).  I didn't see any other way of doing it.  Are
> you telling me there is another way?
>
>
> On 03/07/2014 09:46, Stephen Connolly wrote:
>
> 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 a topic in the
> Google Groups "Jenkins Developers" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/jenkinsci-dev/9mEnlPmIu1c/unsubscribe.
> To unsubscribe from this group and all its topics, 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.
>

-- 
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