Hi,
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.
1. Looks for a jar named abcl-contrib.jar in the classpath determined by
probing the classloader for the jars it provides.
2. Looks in the directory of the jars in the classpath for a file named
abcl-contrib.jar
Neither of these solutions work if the currently executing jar includes
abcl-contrib and isn't named abcl-contrib.jar.
The following code proves that it is relatively easy to add this capability.
(in-package 'sys)
(sys:add-contrib (make-pathname :defaults (java:jcall "toString" (svref
(java:jcall "getURLs" (sys:boot-classloader)) 0))))
This code properly loads abcl-contrib when the executing jar provides
abcl-contrib, while (require 'abcl-contrib) does not.
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.
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.
For maven users, this means that their uberjars will work by just including
abcl and abcl-contrib as dependencies.
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.
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.
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.
Best Regards,
Ralph Ritoch