| 1 | ABCL-ASDF |
|---|
| 2 | ========= |
|---|
| 3 | |
|---|
| 4 | To use: |
|---|
| 5 | |
|---|
| 6 | CL-USER> (require :abcl-contrib) |
|---|
| 7 | |
|---|
| 8 | CL-USER> (require :abcl-asdf) |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | ABCL specific contributions to ASDF system definition mainly concerned |
|---|
| 12 | with finding JVM artifacts such as jar archives to be dynamically loaded. |
|---|
| 13 | |
|---|
| 14 | Example 1 |
|---|
| 15 | --------- |
|---|
| 16 | |
|---|
| 17 | For the following ASDF definition stored in a file named "log4j.asd" |
|---|
| 18 | that loadable by ASDF |
|---|
| 19 | |
|---|
| 20 | ;;;; -*- Mode: LISP -*- |
|---|
| 21 | (in-package :asdf) |
|---|
| 22 | |
|---|
| 23 | (defsystem log4j |
|---|
| 24 | :components ((:mvn "log4j/log4j/1.2.13"))) |
|---|
| 25 | |
|---|
| 26 | After issuing |
|---|
| 27 | |
|---|
| 28 | CL-USER> (asdf:load-system :log4j) |
|---|
| 29 | |
|---|
| 30 | all the Log4j libraries would be dynamically added to the classpath so |
|---|
| 31 | that the following code would |
|---|
| 32 | |
|---|
| 33 | (let ((logger (#"getLogger" 'log4j.Logger (symbol-name (gensym))))) |
|---|
| 34 | (#"trace" logger "Kilroy wuz here.")) |
|---|
| 35 | |
|---|
| 36 | output the message "Kilroy wuz here" to the log4j logging system. |
|---|
| 37 | |
|---|
| 38 | |
|---|
| 39 | API |
|---|
| 40 | --- |
|---|
| 41 | |
|---|
| 42 | We define an API within the ASDF package consisting of the following |
|---|
| 43 | ASDF classes derived from ASDF:COMPONENT: |
|---|
| 44 | |
|---|
| 45 | JAR-DIRECTORY, JAR-FILE, and CLASS-FILE-DIRECTORY for JVM artifacts |
|---|
| 46 | that have a currently valid pathname representation (i.e. they exist |
|---|
| 47 | on the local filesystem). |
|---|
| 48 | |
|---|
| 49 | The MVN and IRI classes descend from ASDF-COMPONENT, but do not |
|---|
| 50 | directly have a filesystem location. |
|---|
| 51 | |
|---|
| 52 | The IRI component is currently unused, but serves as a point to base |
|---|
| 53 | the inheritance of the MVN component while allowing other forms of |
|---|
| 54 | uri-like resources to be encapsulated in the future. |
|---|
| 55 | |
|---|
| 56 | The MVN component should specifiy a [Maven URI][1] as its PATH. A |
|---|
| 57 | Maven URI has the form "GROUP-ID/ARTIFACT-ID/VERSION" which specifies |
|---|
| 58 | the dependency to be satisfied for this component by resolution |
|---|
| 59 | through the Maven distributed dependency graph. The scheme (the |
|---|
| 60 | initial "mvn://") is implied, usually omitted for brevity. If a |
|---|
| 61 | VERSION is not specified (i.e. by a form like "GROUP-ID/ARTIFACT-ID"), |
|---|
| 62 | then the latest available version of the artifact will be retrieved |
|---|
| 63 | from the network. |
|---|
| 64 | |
|---|
| 65 | [1]: http://team.ops4j.org/wiki/display/paxurl/Mvn+Protocol |
|---|
| 66 | |
|---|
| 67 | The MVN component may specify a CLASSNAME which if present in the |
|---|
| 68 | current jvm, inhibits further loading from the network. This may be |
|---|
| 69 | used to bypass the invocation of Maven. Since classnames are not |
|---|
| 70 | unique to jar archives, this mechanism may not have the desired result |
|---|
| 71 | in all cases, but it is surpisingly, like the rest of Java, "good |
|---|
| 72 | enough" for everyday use. |
|---|
| 73 | |
|---|
| 74 | The MVN component may specify an ALTERNATE-URI which will be added to |
|---|
| 75 | the jvm classpath if Maven cannot be located. Since a Maven URI may |
|---|
| 76 | refer to more than one binary artifact, this may not work in all cases. |
|---|
| 77 | |
|---|
| 78 | For use outside of ASDF, we currently define the generic function |
|---|
| 79 | ABCL-ASDF:RESOLVE which locates, downloads, caches, and then loads |
|---|
| 80 | into the currently executing JVM process all recursive dependencies |
|---|
| 81 | annotated in the ditributed Maven pom.xml graph. |
|---|
| 82 | |
|---|
| 83 | One can muffle the verbosity of the Maven Aether resolver by setting |
|---|
| 84 | ABCL-ASDF:*MAVEN-VERBOSE* to NIL. |
|---|
| 85 | |
|---|
| 86 | Example 2 |
|---|
| 87 | --------- |
|---|
| 88 | |
|---|
| 89 | Bypassing ASDF, one can directly issue requests for the Maven |
|---|
| 90 | artifacts to be downloaded |
|---|
| 91 | |
|---|
| 92 | CL-USER> (abcl-asdf:resolve "com.google.gwt:gwt-user") |
|---|
| 93 | WARNING: Using LATEST for unspecified version. |
|---|
| 94 | "/Users/evenson/.m2/repository/com/google/gwt/gwt-user/2.4.0-rc1/gwt-user-2.4.0-rc1.jar:/Users/evenson/.m2/repository/javax/validation/validation-api/1.0.0.GA/validation-api-1.0.0.GA.jar:/Users/evenson/.m2/repository/javax/validation/validation-api/1.0.0.GA/validation-api-1.0.0.GA-sources.jar" |
|---|
| 95 | |
|---|
| 96 | Notice that all recursive dependencies have been located and installed |
|---|
| 97 | as well. |
|---|
| 98 | |
|---|
| 99 | ABCL-ASDF:RESOLVE does not added the resolved dependencies to the |
|---|
| 100 | current JVM classpath. Use JAVA:ADD-TO-CLASSPATH as follows to do |
|---|
| 101 | that: |
|---|
| 102 | |
|---|
| 103 | CL-USER> (java:add-to-classpath (abcl-asdf:as-classpath (abcl-asdf:resolve "com.google.gwt:gwt-user"))) |
|---|
| 104 | |
|---|
| 105 | Example 3 |
|---|
| 106 | --------- |
|---|
| 107 | |
|---|
| 108 | For a filesystem of jar archives: |
|---|
| 109 | |
|---|
| 110 | ./lib/ext/flora2-reasoner/XSBFlora.jar |
|---|
| 111 | ./lib/ext/iris-reasoner/iris/iris-0.58.jar |
|---|
| 112 | ./lib/ext/iris-reasoner/jgrapht/jgrapht-jdk1.5-0.7.1.jar |
|---|
| 113 | ./lib/ext/log4j/log4j-1.2.14.jar |
|---|
| 114 | ./lib/ext/mandrax-reasoner/commons-collections-2.1.jar |
|---|
| 115 | ./lib/ext/mandrax-reasoner/jdom-b10.jar |
|---|
| 116 | ./lib/ext/mandrax-reasoner/log4j-1.2.8.jar |
|---|
| 117 | ./lib/ext/mandrax-reasoner/mandarax-3.4.jar |
|---|
| 118 | ./lib/ext/mins-reasoner/mins-v0_3.jar |
|---|
| 119 | ./lib/ext/pellet-reasoner/aterm/1.6/aterm-java-1.6.jar |
|---|
| 120 | ./lib/ext/pellet-reasoner/commons-logging/1.1/commons-logging-1.1.jar |
|---|
| 121 | ./lib/ext/pellet-reasoner/kaon/1.2.9/rdfapi.jar |
|---|
| 122 | ./lib/ext/pellet-reasoner/owl-api/1.4.3/abstractparser.jar |
|---|
| 123 | ./lib/ext/pellet-reasoner/owl-api/1.4.3/io.jar |
|---|
| 124 | ./lib/ext/pellet-reasoner/owl-api/1.4.3/rdfparser.jar |
|---|
| 125 | ./lib/ext/pellet-reasoner/owl-api/1.4.3/validation.jar |
|---|
| 126 | ./lib/ext/pellet-reasoner/owl-api/owl-api-econn/2006-04-27/api.jar |
|---|
| 127 | ./lib/ext/pellet-reasoner/owl-api/owl-api-econn/2006-04-27/impl.jar |
|---|
| 128 | ./lib/ext/pellet-reasoner/pellet/pellet.jar |
|---|
| 129 | ./lib/ext/pellet-reasoner/relaxng/1.0/relaxngDatatype.jar |
|---|
| 130 | ./lib/ext/pellet-reasoner/xsdlib/xsdlib.jar |
|---|
| 131 | ./lib/ext/wsmo/WSML-grammar-20081202.jar |
|---|
| 132 | ./lib/ext/wsmo/wsmo-api-0.6.2.jar |
|---|
| 133 | ./lib/ext/wsmo/wsmo4j-0.6.2.jar |
|---|
| 134 | ./lib/ext/xsb-system/interprolog.jar |
|---|
| 135 | |
|---|
| 136 | The following ASDF defintion loads enough JVM artifacts to use the |
|---|
| 137 | [IRIS reasoner][1]: |
|---|
| 138 | |
|---|
| 139 | (defsystem :wsml2reasoner-jars |
|---|
| 140 | :version "0.6.4" ;; last sync with SVN |
|---|
| 141 | :defsystem-depends-on (abcl-contrib abcl-asdf) :components |
|---|
| 142 | ((:module wsml2reasoner |
|---|
| 143 | :pathname "lib/" :components |
|---|
| 144 | ((:jar-file "wsml2reasoner"))) |
|---|
| 145 | (:module iris-libs |
|---|
| 146 | :pathname "lib/ext/iris-reasoner/iris/" :components |
|---|
| 147 | ((:jar-file "iris-0.58"))) |
|---|
| 148 | (:module jgrapht-libs |
|---|
| 149 | :pathname "lib/ext/iris-reasoner/jgrapht/" :components |
|---|
| 150 | ((:jar-file "jgrapht-jdk1.5-0.7.1"))) |
|---|
| 151 | (:module wsmo-libs |
|---|
| 152 | :pathname "lib/ext/wsmo/" :components |
|---|
| 153 | ((:jar-file "WSML-grammar-20081202") |
|---|
| 154 | (:jar-file "wsmo-api-0.6.2") |
|---|
| 155 | (:jar-file "wsmo4j-0.6.2"))) |
|---|
| 156 | (:module log4j-libs |
|---|
| 157 | :pathname "lib/ext/log4j/" :components |
|---|
| 158 | ((:jar-file "log4j-1.2.14"))))) |
|---|
| 159 | |
|---|
| 160 | [1]: http://www.iris-reasoner.org/ |
|---|
| 161 | |
|---|
| 162 | #### Colophon |
|---|
| 163 | |
|---|
| 164 | Mark <evenson.not.org@gmail.com> |
|---|
| 165 | |
|---|
| 166 | Created: 2011-01-01 |
|---|
| 167 | Revised: 2013-03-20 |
|---|
| 168 | |
|---|