Changeset 14788


Ignore:
Timestamp:
06/30/15 18:21:36 (5 years ago)
Author:
Mark Evenson
Message:

Fix ABCL-ASDF usage with maven-3.3.x

Fixed

(ABCL-ASDF:INIT :force t)

so that a complete re-initialization is forced.

Addresses <http://abcl.org/trac/ticket/390>.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/abcl/contrib/abcl-asdf/maven-embedder.lisp

    r14776 r14788  
    183183function in order to bypass the dynamic introspection of the location
    184184of the mvn executable with an explicit value."
     185  (when force
     186    (setf *session* nil
     187          *repository-system* nil))
    185188  (unless (or force *mvn-libs-directory*)
    186189    (setf *mvn-libs-directory* (find-mvn-libs)))
    187190  (unless (and *mvn-libs-directory*
    188191               (probe-file *mvn-libs-directory*))
    189     (error "Please obtain and install maven-3.0.4 or lates locally from <http://maven.apache.org/download.html>, then set ABCL-ASDF:*MVN-LIBS-DIRECTORY* to the directory containing maven-core-3.*.jar et. al."))
     192    (error "Please obtain and install maven-3.0.3 or later locally from <http://maven.apache.org/download.html>, then set ABCL-ASDF:*MVN-LIBS-DIRECTORY* to the directory containing maven-core-3.*.jar et. al."))
    190193  (unless (ensure-mvn-version)
    191194    (error "We need maven-3.0.4 or later."))  (add-directory-jars-to-class-path *mvn-libs-directory* nil)
     
    251254        (wagon-provider-class
    252255         (or
     256          (ignore-errors ;; Maven-3.3.x
     257            (jss:find-java-class 'connector.transport.TransporterFactory))
    253258          (ignore-errors ;; Maven-3.2.5
    254259            (jss:find-java-class 'org.eclipse.aether.transport.wagon.WagonProvider))
     
    281286          (ignore-errors
    282287            (java:jclass "org.sonatype.aether.RepositorySystem")))))
    283     (#"setServices" locator
    284                     wagon-provider-class
    285                     (java:jarray-from-list
    286                      (list (make-wagon-provider))))
     288
     289    (if (equal wagon-provider-class (ignore-errors (jss:find-java-class 'TransporterFactory)))
     290        ;;; Maven-3.3.3
     291        (let ((wagon-transporter-factory (jss:new 'WagonTransporterFactory)))
     292          (#"setWagonProvider" wagon-transporter-factory (make-wagon-provider))
     293          (#"setServices" locator
     294                          wagon-provider-class
     295                          (java:jarray-from-list (list wagon-transporter-factory))))
     296        (#"setServices" locator
     297                        wagon-provider-class
     298                        (java:jarray-from-list
     299                         (list (make-wagon-provider)))))
    287300    (#"addService" locator
    288301                   repository-connector-factory-class
     
    365378(defun make-artifact (artifact-string)
    366379  "Return an instance of aether.artifact.DefaultArtifact initialized from ARTIFACT-STRING."
    367   (or 
    368    (ignore-errors
    369      (jss:new "org.sonatype.aether.util.artifact.DefaultArtifact" artifact-string))
    370    (ignore-errors
    371      (jss:new 'aether.artifact.DefaultArtifact artifact-string))))
     380  (or
     381   (ignore-errors
     382     (jss:new 'aether.artifact.DefaultArtifact artifact-string))
     383   (ignore-errors
     384     (jss:new "org.sonatype.aether.util.artifact.DefaultArtifact" artifact-string))))
    372385
    373386(defun make-artifact-request ()
     
    454467         (dependency
    455468          (java:jnew (jss:find-java-class 'aether.graph.Dependency)
    456                      artifact (java:jfield (jss:find-java-class "JavaScopes") "RUNTIME")))
     469                     artifact (java:jfield (jss:find-java-class "JavaScopes") "COMPILE")))
    457470         (collect-request (java:jnew (jss:find-java-class "CollectRequest"))))
    458471    (#"setRoot" collect-request dependency)
    459     (when repository
    460       (#"addRepository" collect-request
    461                         (if repository-p
    462                             (ensure-remote-repository :repository repository)
    463                             (ensure-remote-repository))))
     472    (#"addRepository" collect-request
     473                      (if repository-p
     474                          (ensure-remote-repository :repository repository)
     475                          (ensure-remote-repository)))
    464476    (let* ((node
    465477            (#"getRoot" (#"collectDependencies" (ensure-repository-system) (ensure-session) collect-request)))
    466            (dependency-request
     478           (dependency-request
     479            ;;; pre Maven-3.3.x
     480            #+nil
    467481            (java:jnew (jss:find-java-class "DependencyRequest")
    468                        node java:+null+))
     482                       node java:+null+)
     483            (jss:new 'DependencyRequest))
    469484           (nlg
    470485            (java:jnew (jss:find-java-class "PreorderNodeListGenerator"))))
     486      (#"setRoot" dependency-request node)
    471487      (#"resolveDependencies" (ensure-repository-system) (ensure-session) dependency-request)
    472488      (#"accept" node nlg)
Note: See TracChangeset for help on using the changeset viewer.