Skip to content
This repository has been archived by the owner on Sep 14, 2023. It is now read-only.

Unclear whether Maven/Java based deps are supported #44

Open
GavinEsbergerOVO opened this issue Mar 10, 2021 · 2 comments
Open

Unclear whether Maven/Java based deps are supported #44

GavinEsbergerOVO opened this issue Mar 10, 2021 · 2 comments

Comments

@GavinEsbergerOVO
Copy link

It is unclear from the README whether there is support for Maven/Java based dependencies or not.
I've create a test project that suggests it is not, however, I'd like it clarified whether this is to be expected or if I'm running into an issue.

I've create a new lein app via lein new git-down-test. Then I modified to project.clj to be as follows:

(defproject git-down-test "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url "http://example.com/FIXME"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure "1.10.0"]
                 ;;
                 ;[org.apache.commons/commons-lang3 "6b9964f"]
                 [org.apache.commons/commons-lang3 "3.12.0"]
                 ;;
                 ]
  :main ^:skip-aot git-down-test.core
  :repositories [["public-github" {:url "git://github.com"}]]
  :plugins [[reifyhealth/lein-git-down "0.4.0"]]
  :middleware [lein-git-down.plugin/inject-properties]
  :git-down {org.apache.commons/commons-lang3 {:coordinates apache/commons-lang}}
  :target-path "target/%s"
  :profiles {:uberjar {:aot :all}})

I can then proves this works via the following

~/I/p/git-down-test $ lein repl
nREPL server started on port 50263 on host 127.0.0.1 - nrepl://127.0.0.1:50263
REPL-y 0.3.7, nREPL 0.2.12
Clojure 1.10.0
OpenJDK 64-Bit Server VM 11.0.2+9
    Docs: (doc function-name-here)
          (find-doc "part-of-name-here")
  Source: (source function-name-here)
 Javadoc: (javadoc java-object-or-class-here)
    Exit: Control+D or (exit) or (quit)
 Results: Stored in vars *1, *2, *3, an exception in *e

git-down-test.core=> (import org.apache.commons.lang3.RandomUtils)
org.apache.commons.lang3.RandomUtils
git-down-test.core=> (RandomUtils/nextBoolean)
false

However, when I modify the project.clj to use [org.apache.commons/commons-lang3 "6b9964f"] instead then the following happens.

~/I/p/git-down-test $ lein deps
Retrieving apache/commons-lang/6b9964f/commons-lang-6b9964f.pom from public-github
Retrieving apache/commons-lang/6b9964f/commons-lang-6b9964f.jar from public-github
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by clojure.lang.Reflector (file:/usr/local/Cellar/leiningen/2.8.1/libexec/leiningen-2.8.1-standalone.jar) to method com.sun.org.apache.xerces.internal.dom.CoreDocumentImpl.getDocumentElement()
WARNING: Please consider reporting this to the maintainers of clojure.lang.Reflector
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Created /Users/me/.gitlibs/libs/apache/commons-lang/6b9964ff4b89205d63eac3db005757edf19e9dda/target/commons-lang3-3.12.1-SNAPSHOT.jar
~/I/p/git-down-test $ lein repl
nREPL server started on port 49638 on host 127.0.0.1 - nrepl://127.0.0.1:49638
REPL-y 0.3.7, nREPL 0.2.12
Clojure 1.10.0
OpenJDK 64-Bit Server VM 11.0.2+9
    Docs: (doc function-name-here)
          (find-doc "part-of-name-here")
  Source: (source function-name-here)
 Javadoc: (javadoc java-object-or-class-here)
    Exit: Control+D or (exit) or (quit)
 Results: Stored in vars *1, *2, *3, an exception in *e

git-down-test.core=> (import org.apache.commons.lang3.RandomUtils)

Execution error (ClassNotFoundException) at java.net.URLClassLoader/findClass (URLClassLoader.java:471).
org.apache.commons.lang3.RandomUtils

If this is not expected to work then I'm not requesting it, merely that it more clearly stated this is not the intention.

@manderson202
Copy link
Collaborator

Thanks for raising the issue. The intent of lein-git-down is primarily for Clojure projects. There is nothing necessarily stopping someone from using it to bring in Java/mvn projects, but that project would have to have a very simple pom (eg: just dependencies, src path, resource path) since the tool doesn't know how to build a full Maven project. Looks like commons/lang3 references a parent pom and uses some Maven build plugins. The resulting jar isn't built correctly and so the class can't be found on the classpath. Will make a note to add a comment in the README for a future release.

@aiba
Copy link

aiba commented Jun 22, 2021

I would be thrilled if it were possible in a future release to use lein-git-down to depend on Java/mvn projects.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants