<div dir="ltr"><div><div>Hi,<br><br></div>There is one small correction to the code used for testing.<br><br></div>(in-package :sys)<br><div>(add-contrib (make-pathname :defaults (java:jcall "toString" (svref (java:jcall "getURLs" (boot-classloader)) 0))))<br><br></div><div>The code I sent in the proposal will not work because the functions from the sys package are private. <br><br></div><div>Best Regards,<br></div><div> Ralph Ritoch<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Jul 26, 2015 at 8:29 PM, Ralph Ritoch <span dir="ltr"><<a href="mailto:rritoch@gmail.com" target="_blank">rritoch@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div><div>Hi,<br><br></div> I have run into an issue with making executable abcl jars when the jar depends on, and provides, abcl-contrib. As far as I can tell abcl looks for abcl-contrib in the following locations.<br><br></div>1. Looks for a jar named abcl-contrib.jar in the classpath determined by probing the classloader for the jars it provides.<br></div>2. Looks in the directory of the jars in the classpath for a file named abcl-contrib.jar<br><br></div>Neither of these solutions work if the currently executing jar includes abcl-contrib and isn't named abcl-contrib.jar.<br><br></div>The following code proves that it is relatively easy to add this capability.<br><br></div>(in-package 'sys)<br><div>(sys:add-contrib (make-pathname :defaults (java:jcall "toString" (svref (java:jcall "getURLs" (sys:boot-classloader)) 0))))<br><br></div><div>This code properly loads abcl-contrib when the executing jar provides abcl-contrib, while (require 'abcl-contrib) does not.<br><br></div><div>My proposal is to add a file named abcl-contrib/version.lisp to the abcl-contrib.jar, possibly in the /META-INF directory to avoid any potential conflicts with java, and to have sys:find-contrib look for this file in the resources provided by the classpath. The contents of this file is not important.<br><br>This change makes it possible to include the abcl-contrib "dependency" directly inside the jar application that is currently running, regardless of the name of the jar file. Therefore, applications which make use of abcl-contrib can be distributed as a single jar.<br><br>For maven users, this means that their uberjars will work by just including abcl and abcl-contrib as dependencies. <br><br>For ant users they would probably need to extract abcl-contrib and include the extracted files in their generated jar which I believe can be fully automated.<br><br></div><div>It would be relatively easy for me to produce a patch to provide this feature as part of ABCL. It may be possible to provide this feature as an add-on, but the functions needed within the system package are private (not exported) so it would be difficult, if not impossible, to implement this feature as an add-on.<br><br></div><div>I would like your feedback on this issue. If this is a feature you want, or if you have any specific objections to including this feature in ABCL, please let me know.<br><br></div><div>Best Regards,<br></div><div> Ralph Ritoch<br></div><div><br><br></div><div><br><br></div></div>
</blockquote></div><br></div>