Opened 10 years ago

#367 new enhancement

Add easy way to load ASDF systems (and other software?) from classpath jars

Reported by: Robert Goldman Owned by:
Priority: major Milestone:
Component: other Version:
Keywords: Cc:
Parent Tickets:

Description

I have been writing a Java program that uses some code implemented in ABCL. I packaged everything up with ASDF-JAR and put the Jar file in the command line.

The original idea was to provide an easy way for the program to find my code. But it hasn't panned out that well for me.

Here's a bit of extremely ugly code that I wrote to find and load the jar file out of the class path. I don't know if this code can be improved using the existing API (in which case, this is my bad, not an enhancement request). Alternatively, perhaps it would be good to find a way to add jars from the classpath to the ASDF registry. Or even preload the systems in the jar files.

interpreter = Interpreter.createInstance();
interpreter.eval("(require :abcl-contrib)");
interpreter.eval("(require :asdf)");
interpreter.eval("(require :asdf-jar)");
interpreter.eval("(defparameter *my-jar-name* \"abcl-prism-all\")");
interpreter.eval("(defparameter *jar* (find *my-jar-name* (loop for x in (dump-classpath) appending (remove-if-not \'pathnamep (rest x))) :test \'equalp :key \'pathname-name))");
interpreter.eval("(if *jar* (if (probe-file *jar*) (format t \"Adding ~a to ASDF searchpath.\" *jar*) (error \"Found ~A in classpath, but jar file doesn't exist.\" *my-jar-name*)) (error \"Can\'t find ~a in ~s\" *my-jar-name* (dump-classpath)))");
interpreter.eval("(asdf-jar:add-to-asdf *jar*)");
interpreter.eval("(asdf:load-system :abcl-prism)");

Mark has also expressed a desire to better support adding jars to the ASDF configuration.

Change History (0)

Note: See TracTickets for help on using tickets.