Ticket #390: maven.diff

File maven.diff, 4.4 KB (added by Mark Evenson, 5 years ago)

patch for maven-3.3.3

  • contrib/abcl-asdf/maven-embedder.lisp

    # HG changeset patch
    # Parent  1ce55192468b913fccc847edadcec2b9694a955a
    Fix ABCL-ASDF usage with maven-3.3.x
    
    Addresses <http://abcl.org/trac/ticket/390>.
    
    diff -r 1ce55192468b contrib/abcl-asdf/maven-embedder.lisp
    a b  
    182182Set *MVN-LIBS-DIRECTORY* to an explicit value before running this
    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*
     
    250253         (find-service-locator))
    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))
    255260          (ignore-errors  ;; Maven-3.1.x
     
    280285            (jss:find-java-class 'aether.RepositorySystem))
    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
    289302                   wagon-repository-connector-factory-class)
     
    364377
    365378(defun make-artifact (artifact-string)
    366379  "Return an instance of aether.artifact.DefaultArtifact initialized from ARTIFACT-STRING."
    367   (or 
     380  (or
    368381   (ignore-errors
    369      (jss:new "org.sonatype.aether.util.artifact.DefaultArtifact" artifact-string))
     382     (jss:new 'aether.artifact.DefaultArtifact artifact-string))
    370383   (ignore-errors
    371      (jss:new 'aether.artifact.DefaultArtifact artifact-string))))
     384     (jss:new "org.sonatype.aether.util.artifact.DefaultArtifact" artifact-string))))
    372385
    373386(defun make-artifact-request ()
    374387  "Construct a new aether.resolution.ArtifactRequest."
     
    453466          (make-artifact coords))
    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)
    473489      (#"getClassPath" nlg))))