You could make your own simple AdjunctManager and expose a web method in a
descriptor or hidden root action that uses for example Stapler.serveFile.
Just be careful not to expose the entire class hierarchy :)
And possibly provide an etag or expiration date so the browser doesn't
continuously hammer your method.

/B

Den tors 31 okt. 2019 kl 00:01 skrev Ullrich Hafner <
[email protected]>:

> In stapler-adjunct-jquery
> <https://github.com/stapler/stapler-adjunct-jquery> the JS file is part
> of the main plugin jar. That works for me as well:
> I can access all my JS files using the prefix ${resURL}/plugin/warnings-ng
>
> However, if I have resources in a library of my project, I seems to be
> that I can’t access them with ${resURL}/plugin/warnings-ng
> So what works is to extract the dependency and copy the containing JS
> files to the target folder and then pack them with the main jar. This is
> how  stapler-adjunct-jquery
> <https://github.com/stapler/stapler-adjunct-jquery> does it, but it
> is somewhat cumbersome, it would be much simpler if I can refer to the
> resources in one of my dependencies jars (i.e. in the webjar).
>
>
> Am 30.10.2019 um 16:57 schrieb Robert Sandell <[email protected]>:
>
> Stapler has a mechanism called adjuncts that works similarly.
> For example https://github.com/stapler/stapler-adjunct-jquery
>
> /B
>
> Den lör 26 okt. 2019 kl 13:03 skrev Ullrich Hafner <
> [email protected]>:
>
>> Has someone already used WebJars (https://www.webjars.org) in a plugin
>> to refer to JS libraries?
>>
>> While it seems to be simple to bundle it with my HPI file (it is then
>> part of the WEB-INF/lib folder) I do not see an easy way to refer to the
>> containing css/js files afterwards, since they are located in a jar file
>> that seems to be not accessible in Jenkins UI.
>>
>> I can reference my local plugin web resources with
>>
>> <link rel="stylesheet" href
>> ="${resURL}/plugin/warnings-ng/css/font-awesome/css/fontawesome.min.css"
>> />
>>
>> But the same does not work when the fontawesome.min.css is part of the
>> other webjar. (Or which path do I need here?)
>>
>>
>>
>>
>> --
>> 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].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/jenkinsci-dev/740C8BC3-AD97-4A4B-9148-8DF5547480F7%40gmail.com
>> <https://groups.google.com/d/msgid/jenkinsci-dev/740C8BC3-AD97-4A4B-9148-8DF5547480F7%40gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>
>
> --
> *Robert Sandell*
> Software Engineer
> CloudBees, Inc.
> [image: CloudBees-Logo.png] <http://www.cloudbees.com/>
> E: [email protected]
> Twitter: robert_sandell
>
> --
> 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].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-dev/CALzHZS3qvKA2uOSNk8thvhOxtgMAKpYMDCqrLK2V-FshvcSqYQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/jenkinsci-dev/CALzHZS3qvKA2uOSNk8thvhOxtgMAKpYMDCqrLK2V-FshvcSqYQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
>
> --
> 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].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-dev/26DA20F2-A3FC-477D-A6A2-D7C853ACE277%40gmail.com
> <https://groups.google.com/d/msgid/jenkinsci-dev/26DA20F2-A3FC-477D-A6A2-D7C853ACE277%40gmail.com?utm_medium=email&utm_source=footer>
> .
>


-- 
*Robert Sandell*
Software Engineer
CloudBees, Inc.
[image: CloudBees-Logo.png] <http://www.cloudbees.com/>
E: [email protected]
Twitter: robert_sandell

-- 
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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/CALzHZS3Xdg-NBwCahXaXK2ykVq%2B_ZeaLgdYqCaEmXfHaJQeGew%40mail.gmail.com.

Reply via email to