Fork me on GitHub
#clojure-dev
<
2018-05-01
>
sophiago11:05:32

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 anything...at 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 java.io.FileNotFoundExceptions. 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: https://github.com/Sophia-Gold/anaphora/blob/master/project.clj

sophiago11:05:26

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.

sophiago11:05:26

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.

sophiago14:05:00

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 😕

andy.fingerhut15:05:23

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.

sophiago15:05:52

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.

andy.fingerhut15:05:33

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?

sophiago15:05:35

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

andy.fingerhut15:05:57

How "inside it"?

sophiago15:05:17

Local to the project file.

sophiago15:05:46

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

sophiago15:05:56

As in the deps of the fork.

andy.fingerhut15:05:13

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.

andy.fingerhut16:05:18

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.

sophiago16:05:54

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

andy.fingerhut16:05:16

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

sophiago16:05:26

No, not at all.

andy.fingerhut16:05:34

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

sophiago16:05:56

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

sophiago16:05:03

That's the issue.

andy.fingerhut16:05:09

meaning spec.alpha ?

sophiago16:05:15

That is one of several.

andy.fingerhut16:05:37

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

andy.fingerhut16:05:00

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

sophiago16:05:52

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

sophiago16:05:29

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

sophiago16:05:54

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

sophiago16:05:16

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

sophiago16:05:03

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

sophiago16:05:04

Yup, that works.

andy.fingerhut16:05:11

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?

sophiago16:05:46

I have other deps from org.clojure

sophiago16:05:21

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

andy.fingerhut16:05:38

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.

sophiago16:05:52

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

sophiago16:05:10

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

andy.fingerhut16:05:37

Sorry, I have never seen this in a project.clj file before: https://github.com/Sophia-Gold/anaphora/blob/master/project.clj#L5 is what I was confused by. Not sure what that does.

sophiago16:05:33

It's refers to the :repositories field in defproject

sophiago16:05:49

So this is the issue from the mailing list years ago: https://gist.github.com/stuartsierra/3062743

sophiago16:05:09

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

sophiago16:05:34

:repositories specifies the path

andy.fingerhut16:05:42

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.

sophiago16:05:20

Yes, I tried that initially

andy.fingerhut16:05:35

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.

sophiago16:05:21

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

sophiago16:05:42

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 😛

andy.fingerhut16:05:33

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.

andy.fingerhut16:05:41

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.

sophiago16:05:24

Huh. Let me give it a whirl

andy.fingerhut16:05:52

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 https://gist.github.com/jafingerhut/55b75c6f5e872349bf85b9a3c7828130

sophiago16:05:42

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

sophiago16:05:02

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

andy.fingerhut16:05:47

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

sophiago16:05:11

That is 100% of my question here.

andy.fingerhut16:05:19

I did "git clone https://github.com/clojure/clojure" 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

andy.fingerhut16:05:44

not sure if that is what you are asking

andy.fingerhut16:05:14

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

sophiago16:05:24

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.

sophiago16:05:00

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

andy.fingerhut16:05:44

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.

andy.fingerhut16:05:57

Does that, and my comments above, clarify anything?

sophiago16:05:52

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.

andy.fingerhut16:05:44

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

sophiago16:05:31

That was the question I asked, yes.

andy.fingerhut16:05:03

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.

andy.fingerhut16:05:19

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.

andy.fingerhut16:05:52

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

andy.fingerhut17:05:49

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

andy.fingerhut17:05:24

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

andy.fingerhut17:05:13

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.