Adding clojure dependencies and running lein uberjar raises java.lang.IllegalAccessError

I am a novice engineer with experience writing PHP, python and ruby. I am trying to contribute to a project written in clojure. I am trying to add a library to the project, but after adding the library and running lein uberjar , I get an error. I would like to know what this means and if you can recommend a troubleshooting method. Thank you in advance for your help!

What I'm trying to achieve Include a uap-clj library in my project and compile the project in jarfile.

What I wrote I added the library as the second to the last item in the dependency list.

  :dependencies [[lots-of-dependencies] [uap-clj "1.1.1"] ; user agent parser [another-dependency]] 

What I ran in lein According to the github instructions, after saving the changes in project.clj, I run lein deps , then lein clean && lein uberjar .

What happened After updating and saving the file, running the command gives the following error before the long stacktrace:

 java.lang.IllegalAccessError: tried to access method clojure.lang.RT.classForNameNonLoading(Ljava/lang/String;)Ljava/lang/Class; from class clj_yaml.core$loading__5340__auto____29, compiling:(flexmaster.clj:1:1) 

What else I tried I wanted to check if I made a mistake by adding a library. I created a new clojure project from scratch and created a jarfile using lein deps and then lein uberjar . Then I added uap-clj to the dependencies: in my new project, saved project.clj and lein deps and lein uberjar . I managed to create a jarfile, so I believe that I am adding the library correctly.

I can’t think of another reason why the act of including another dependency did not stop me from creating a jarfile. If you can think of something that I should check based on the information I provided, that would help me a lot. Thanks!

+5
source share
1 answer

It looks like the reference library is dependent on Clojure 1.7.0, but you are explicitly referencing version 1.6.0.

Try changing:

 [org.clojure/clojure "1.6.0"] 

in

 [org.clojure/clojure "1.7.0"] 

Alternatively, you can reference an older version of the library that is not dependent on Clojure 1.7.0, for example: [uap-clj "1.0.1"]

+4
source

Source: https://habr.com/ru/post/1237211/


All Articles