Fork me on GitHub

I wasn't quite sure what channel to direct this question to so please bear with me: I'm trying to play around with a fork of clojure (reverted to the commit when 1.9 was released to be safe) that just deletes two lines to allow nested function literals. I've discussed this before in here and am almost certain the changes shouldn't break the very least not the things they're breaking now. My hypothesis at the moment is when building clojure locally with maven I somehow ended up messing with the class loader. I get different errors depending on which dependencies I comment out, but the common thread seems to be various symbols in clojure.core not resolving. Those are about half the error messages I get from lein repl with the other half being This is quite a shot in the dark, but I'm wondering if anyone has experienced issues like this before when building local forks with maven and can at least point me in the right direction. As you can see, my project.clj at least appears to be relatively straightforward:


Oh... lein is telling me it's Clojure 1.4.0 :woman-facepalming:. I didn't even think to notice that since I have no idea how that could be the case.


So lein deps :tree makes it pretty clear I need to exclude the version of clojure from maven from my dependencies. Guessing the least common denominator between them was somehow 1.4? Regardless, seems I spoke too soon; I should be able to resolve this on my own.


So the issue seems to be the old s/`mvn install:install-file`/`mvn deploy:deploy-file` except the fork is local to the particular repo it's used in so lein still isn't locating its deps even with the checksums 😕


When you did 'mvn install' did you see the version number it used for your local Clojure build? Maybe 1.10.0-SNAPSHOT or 1.9.0, depending on exactly which git commit you rolled back to? I would think that is the version you should be trying to depend upon from a different project using your locally built Clojure. 1.10.0-SNAPSHOT might be a little less confusing to locally install for you in the future, when/if you want to use the official Clojure 1.9.0 release.


I changed the version number to one that's not used in an official build to check it was being loaded from inside the repo.


And then you are using a separate Leiningen project whose project.clj depends upon that custom version number of Clojure, but somehow Leiningen is using a different version than your locally built one?


There's one lein project with the clojure fork inside it. I changed the version number to disambiguate it from those in maven local.


How "inside it"?


Local to the project file.


And to be clear, it is loading the correct version. It's not loading its deps.


As in the deps of the fork.


So in the past I have used "mvn install" from inside a locally modified Clojure source code tree I had changed myself, and looked at the version number, e.g. "1.10.0-SNAPSHOT". I sometimes have double-checked it was in my $HOME/.m2 directory tree somewhere, and modified around the time that "mvn install" finished. Then I created a separate lein project with project.clj depending upon org.clojure/clojure "1.10.0-SNAPSHOT", done 'lein repl', and saw that version number appear, and my local changes were taking effect in that REPL.


The only way in which my lein project referred to my custom-built Clojure was via the lein project's project.clj file. There was no correspondence in my file system to where the locally modified Clojure source tree and my lein project were.


Yes, of course. How else would lein locate the correct version if I specified a different one?


Sorry, just trying to be specific, and maybe accidentally sounding insulting.


No, not at all.


So perhaps the errors you are seeing are because of your modified version of Clojure, then?


No, I mentioned that above. The issue is it's not loading Clojure's deps.


That's the issue.


meaning spec.alpha ?


That is one of several.


I thought the Clojure project itself only had one or two direct deps, related to spec, and no others?

Alex Miller (Clojure team)16:05:58

yes, spec.alpha and core.specs.alpha


and that started with Clojure 1.9.0 (older versions of Clojure had 0 deps on other projects)


But it's the same issue regardless.

Alex Miller (Clojure team)16:05:01

the others are test-only deps

Alex Miller (Clojure team)16:05:09

so not needed at runtime


Yeah I figured. I do know I can always just specify the deps in the project.clj I'm working from.


But otherwise it seems exactly like Stuart's issue I mentioned above


Except that was in maven local, not inside the repo itself.


I should just put them in the project.clj to check my reasoning


Yup, that works.


I have no idea if this could possibly be related, but when I've built locally modified versions of Clojure before, I've left its Maven project name as org.clojure/clojure. I looked at your project.clj file linked above and noticed you changed it to 'local/clojure'. Maybe try going back to org.clojure/clojure with a custom version number?


I have other deps from org.clojure


And I didn't change the project name wrt to maven. That's just local to the repo


Installing org.clojure/clojure "1.9.99999" locally in your $HOME/.m2 should not affect any other JARs you have from org.clojure, as far as I know.


That's exactly what I'm not doing here.


I'm installing it local to the repo, not in maven local.


Sorry, I have never seen this in a project.clj file before: is what I was confused by. Not sure what that does.


It's refers to the :repositories field in defproject


So this is the issue from the mailing list years ago:


The difference here is it's local to the repo, not in ~/.m2


:repositories specifies the path


So I may have missed it in your comments above, but have you tried it with no :exclusions in your project.clj, and org.clojure/clojure "1.9.99999" in your lein deps, after doing just a plain "mvn install" in your modified Clojure source tree? If so, and it failed for some reason that looks unrelated to your Clojure changes, then I'm probably out of my depth here.


Yes, I tried that initially


OK. In the few cases I have experimented with locally modified Clojure versions, that approach has worked for me, so not sure what might be going wrong here.


This is the only time I've had one local to the project file and with its own deps. The latter is a new thing, unless there are cases that predate me


Anyway, I just figured someone here may have bundled 1.9 with an example lein project so people could clone it. Otherwise, I should ask in the lein channel or just let it go that I'm adding two lines to my project.clj 😛


So I cloned your repo, and replaced local/clojure with org.clojure/clojure "1.10.0-master-SNAPSHOT" (I was leaving out the "-master" part in my earlier messages -- it is needed), and removed the explicit dependencies on the 2 spec repos, commented out the :exclusions and :repositories lines, and it is using my locally modified version of Clojure. I get error messages when doing "lein repl" about "Nested #()s are not allowed" likely because of Clojure source files in there that try to do that, related to your Clojure changes that I do not have.


It does get to a REPL prompt successfully after a page or so of error messages related to that, and I can run the one Clojure function I modified to see that I am running my locally modified Clojure, not an officially released one.


Huh. Let me give it a whirl


Here is my modified version of your project.clj file I am using, after installing my locally built org.clojure/clojure "1.10.0-master-SNAPSHOT" in my $HOME/.m2


Does it work if you move the clone into the project file?


And if so, can you clarify how you built it with mvn?


I am not sure what you mean by moving the clone into the project file, in order to try it.


That is 100% of my question here.


I did "git clone" did git checkout to the first version with '1.10.0-master-SNAPSHOT' as the version, made another 1-line local change, and used "mvn3 install" to compile, test, and install that version of Clojure into my $HOME/.m2


not sure if that is what you are asking


Then in my copy of your anaphora project, I edited project.clj to match what is in the gist, then typed "lein repl"


When you create a lein project it's in a directory. Maven also obviously has ~/.m2. When I say "inside the project file" I mean putting a dependency inside the former rather than the latter. I already know how to do the former.


And the latter, when it doesn't have its own deps.


In my copy of your anaphora project, I have not copied any jar files into it, or changed any files in any way, except the project.clj file.


Does that, and my comments above, clarify anything?


You already mentioned that wasn't the case. What I'm attempting to communicate is that what you didn't do in this test case is the very question I asked.


So, you prefer to have a solution where the modified Clojure JAR is moved into the lein project?


That was the question I asked, yes.


Sorry, I often stop experimenting with these things when I have one way that works 🙂 Let me try to see if I can do what you are asking.


Do you want me to try using a particular 'mvn' command line to build and install Clojure? I've gotten success on my system with the commands I've mentioned above. I could try just copying my locally built Clojure JAR from my $HOME/.m2 into your anaphora project's maven_repository directory somewhere, but suspect that is not what you are asking.


Out of curiosity, did you try the steps that I did, and did it work for you?


I don't know if I used the correct options to this command to copy my locally built Clojure JAR into my copy of your anaphora project's maven_repository directory, but this is what I just tried, and it did create files in the maven_repository directory: mvn3 install:install-file -DgroupId=local -DartifactId=clojure -Dversion=1.10.0-master-SNAPSHOT -Dpackaging=jar -Dfile=$HOME/.m2/repository/org/clojure/clojure/1.10.0-master-SNAPSHOT/clojure-1.10.0-master-SNAPSHOT.jar -DlocalRepositoryPath=maven_repository


I changed project.clj from its original checked-in version, to use: local/clojure "1.10.0-master-SNAPSHOT" instead of 1.9.9999...


When I typed "lein repl", the first error I saw was the following:

Retrieving local/clojure/1.10.0-master-SNAPSHOT/clojure-1.10.0-master-SNAPSHOT.pom from local
Could not transfer artifact local:clojure:pom:1.10.0-master-SNAPSHOT from/to local (file:/Users/jafinger/clj/anaphora/maven_repository/): no supported algorithms found
This could be due to a typo in :dependencies or network issues.
If you are behind a proxy, try setting the 'http_proxy' environment variable.