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