Fork me on GitHub
#leiningen
<
2021-08-10
>
manas_marthi12:08:29

Hi All, need a help.. can lein use my .m2/settings.xml?

manas_marthi12:08:03

If not how to specify corporate proxy info, maven <server> info, mirrors,<repositories>

manas_marthi12:08:14

in project.clj

manas_marthi12:08:58

and pluginRepositeries as well...

edo14:08:50

Hi everyone 👋 , not sure this is the right place to post this question. I’m a beginner and I’m struggling to deploy my lein api project to heroku. I’m getting this error on heroku, while deplyoing, which I can’t overcome. I’m using openJDK 1.8.2 in my local machine.

Compiling clojures-backend.core
       Syntax error macroexpanding at (trie.cljc:1:1).
       Execution error (UnsupportedClassVersionError) at java.lang.ClassLoader/defineClass1 (ClassLoader.java:-2).
       reitit/Trie has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
Any hints on how to solve this?

edo14:08:35

oh, I’ve sorted it out. For anyone struggling with this one possible solution is to create a system.properties file in the root of your project and specify

java.runtime.version=11
This way heroku we’ll use JDK 11. 🚀

mikerod21:08:13

@mrkiouak try to use the same profile for deps :tree as for uberjar. if you don’t have anything special defined for that then:

lein with-profile uberjar deps :tree

rkiouak21:08:18

Note I really ought to have showed the command as lein jar I apologize for that, i failed a context switch check -- everything else applies, but the behavior of unexpected included jars is for lein jar not lein uberjar

mikerod17:08:24

lein jar shouldn’t be including any of your dependencies in it at all. That’s what an uberjar does as opposed to normal “slim” jars.

mikerod17:08:31

What you showed above was classfiles

mikerod17:08:41

Those are only there if you are AOT compiling clj

mikerod17:08:06

So the most obvious solution is to be sure you aren’t aot compiling for the jar task

mikerod17:08:46

If you must have aot compilation in a jar. Lein should be able to filter it via it’s built in flag there but there could be caveats and I don’t know your setup to know why it wouldn’t already be filtering the non project classfiles

rkiouak17:08:06

That's interesting. I'd "worked around" this by moving the nses that needed aot to another library, which eliminated the other dependencies appearing as aoted in the jar file, presumably because the separate jar has a much, much smaller set of dependencies that may not get filtered. I think we do need the aot of two nses because of gen-class created classes intended for interop with a native java servlet, but I can double check that.

rkiouak21:08:14

Thanks, that appears to be an exact explanation (in the jira item) for the behavior I was seeing, and when I get a chance to try that flag I suspect it will remove the issue without a dependency move as well. Thanks for looking at this, and pointing out the history and how this isn't a strange leiningen default, but due to decisions made by the clojure aot compiler!

👍 2
mikerod21:08:05

Yes indeed. A bit of a complicated topic

mikerod21:08:57

Glad this info helped out some

rkiouak17:08:17

I’m still seeing a:

% ls
META-INF	clojure		protojure
shouldn’t I expect clojure/* class files to be deleted as its an artifact from project dependencies?

rkiouak17:08:28

(where that ls is in an unzip of the generated jar)

mikerod04:08:32

I don’t see a class file in above

rkiouak11:08:56

I suppose I ought to have done a find .., just assumed the directory structure had classes under them. Thanks…