This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-11-02
Channels
- # announcements (2)
- # aws (13)
- # beginners (52)
- # boot (10)
- # calva (2)
- # cider (23)
- # clara (23)
- # cljs-dev (16)
- # cljsrn (5)
- # clojure (69)
- # clojure-brasil (1)
- # clojure-conj (3)
- # clojure-dev (41)
- # clojure-india (2)
- # clojure-italy (39)
- # clojure-nl (5)
- # clojure-russia (2)
- # clojure-spec (5)
- # clojure-uk (51)
- # clojurescript (78)
- # code-reviews (13)
- # data-science (2)
- # datascript (22)
- # datomic (47)
- # duct (13)
- # emacs (4)
- # figwheel-main (45)
- # fulcro (85)
- # funcool (4)
- # jobs (9)
- # nrepl (106)
- # off-topic (5)
- # pathom (7)
- # pedestal (2)
- # re-frame (17)
- # reagent (32)
- # reitit (7)
- # ring-swagger (2)
- # shadow-cljs (33)
- # spacemacs (4)
- # specter (2)
- # tools-deps (203)
- # vim (1)
How long does builds take for you folks in average? I am being told node builds take 5-10 minutes and I want to make sure I am not doing anything wrong before answering. At the moment a monorepo build takes 22 minutes and it downloads ~50 deps
This is more of a #clojurescript question actually
First of all, I know tools.deps/clj is not meant as a build tool. But still: We now have a bunch of utils like pack, Eastwood, depot, testrunner, etc which are useful tools to use in a build pipeline. I know I can add aliases to all of these in my home-directory’s deps.edn, but that doesn’t really work across multiple machines. Having all the aliases duplicated across multiple projects doesn’t seem like a great solution either. One solution I could think of is that deps.edn could refer to other deps.edns and use their aliases. Would that be possible?
what exactly is the problem in duplicating between projects? lack of standardization?
:ancient {:extra-deps {olical/depot {:mvn/version "1.2.0"}}
:main-opts ["-m" "depot.outdated.main"]}
I was imagining that when I wanted to bump the version on olical/depot
, I’d have to check out all my projects and bumpt it.
yup. it’s a difficult trade-off. it’s tempting to standardize or “dedupe” some of this boilerplate, but that creates problems when things aren’t as equal anymore
I’ve come to realise this. But that’s another discussion we could have over a cup of coffee IRL 🙂
if you have a lot of very similar projects I guess you could make your own dev package, and encode the aliases in it, and then use it like so:
{:aliases
:dev {:extra-deps {my.company/my-bundle {:mvn/version "1234"}}}
:test {:main-opts ["my.bundle.test"]}
:ancient {:main-opts ["my.bundle.ancient"]}
:build {:main-opts ["my.bundle.build"]}}
but that approach does quickly leads to entangled framework world, use with caution
I don’t have enough similar projects to warrant the effort, but this is an approach I would consider to contain the duplication and lightly enforce some standardization. you’d still have to bump the shared dependency in all projects, but at least you reduced n
deps/aliases to 1
One thing I noticed really is that when most of those things are just standalone utilities, they shouldn’t even be in my main deps.edn file, because they don’t need all my “production” stuff to run.
Exactly - put them in your ~/.clojure/deps.edn
Meaning, when the Classpath is created, it only has the stuff from ~/.clojure/deps.edn
and nothing from a local deps.edn
file.
no, why would you want that?
In the context of a standalone library, e.g. clj-new
, cljfmt
etc etc that does “build tool” stuff — it has no need to bring in the application-level deps. I’m not sure what the ramifications of having more things in the classpath are though — apart from the potential version conflicts which I think are addressable right now.
I’m always thinking that perhaps it’s time for a new “dev-time” tool that provides a wrapper and some porcelain around those single-purpose libraries. Sure you lose the flexibility, but you also don’t have to make all those decisions when you are a newcomer to the ecosystem, plus the single-purpose libraries can still be used standalone and can evolve at their own pace.
wherever it is, all the deps and scripts required to build and deploy the app should reside in the repo at least
@orestis would such a thing be put into each project? Or be part of the setup guide for ~/.clojure/deps.edn when you're new to a project?
I strongly believe that developing any app should require as few pre-installed tools as possible, and that the code/repo should be as self-contained as possible
I agree with this sentiment too. tools.deps is quite good here, as you can effectively ship tooling with a repo; and version lock the tools - without having to include binaries etc.
But in the end all it would do is generate the correct clj/clojure
invocation for you.
I’m currently using deps.edn + Makefile to get the job done. I see some things that will probably seem like tedious repetition at some point, but so far I’m loving the simplicity of it. no magic, you can see everything
I see your point though @christian767 — though with tools.deps you need to have clj
installed — otherwise, well, you have to fallback to java -cp ...
, no?
yes, I think clj
and java is a good baseline requirement for clojure projects at this point
My experience in trying to setup a new deps.edn
based project was a few days trying out the various uberjar libraries, then a linter, then a formatter, then an outdated-deps-finder etc etc etc.
I think the community would benefit if this is done for you, while still maintaining the much-needed transparency and zero magic.
I wonder how could this move forward? Ask people to upload their deps.edn
and makefiles and shell scripts somewhere and compare approaches? I’m too much of a newb to do this based only on my assumptions, and different projects will have wildly different needs.
@orestis JUXT are solving this with https://github.com/juxt/edge
You start a project by cloning edge, and then modifying it. Everything is set up for you. clj
is all you need.
I wouldn't say scaffolding is a good comparison. It's more of a cookie cutter or starting point than anything.
The issue with templates/scaffolding is that after the initial project creation, you are on your own.
my issue with this approach is that it sets you off for an overwhelming start, and it is too easy to end up with a bunch of stuff laying around that you don’t really need
@orestis that's why we suggest cloning. You can upgrade by doing git merge edge/master
I've been making some adjustments to reduce the chances of conflicts to very low. It should only happen if you modify things (in which case, what do you expect?)
The documentation around this isn't great, but it's how we expect edge to be used, and how we use it internally.
I see your point — and it might be hugely valuable for a consulting company, since you tend to start projects very often, right? I’m more after something that decouples some very common concerns for most people, while imposing no opinions on how your actual app is structured. Meaning, I just want to run a command to give me outdated dependencies, a command to run all my tests, a command to build my uberjar. I’d like newcomers to the community to have a single entry point, and if/when they want more power, be able to drop down to the layer below.
Crucially, they shouldn’t have to know the underlying libraries if they don’t care. Similarly to how you don’t really know how lein builds uberjars.
And also crucially though, the uberjar building library is standalone and people can use it as they see fit.
you could create a binstub on your box, run koacha
in your app, and it’ll “just work”
We start, and maintain, a lot of projects, yep 🙂. edge is slightly more opinionated than that, it assumes integrant for example. But I think the implementation would work for this? Use a git repo, and merge periodically to have the uberjar builder updated by maintainers upstream.
Exactly @christian767, kaocha is very good at that, it has its own CLI - like thing, but you can also use its API if you want to.
Binstubs are only part of the puzzle though 🙂 What would provide: > I think the community would benefit if this is done for you, while still maintaining the much-needed transparency and zero magic. ?
So what I’m after is — a cli tool that you could install, then run XXX test
and it would do the right thing, using kaocha under the hood. Kaocha then can keep evolving and people can use it standalone without the XXX tool.
You wouldn’t know that kaocha is used unless you really want to — kaocha is a very good example since it plays well with clojure.test
. Uberjars can be more fiddly to configure, I guess?
jars need a lot of configuration in my experience 🙂 Clients come up with all sorts of novel environments in which we have to deploy.
I know, but the ideas I’m sort of looking for very quickly lead in that direction, unfortunatly
Even if it’s only @christian767 Makefile or Juxt’s edge.
I’m not 100% sure if this only an “ergonomics” thing — or if some plumbing is still missing from tools.deps
.
Given Stu's advocacy for CLJ-2373 (I've memorized it he's said it so much!), let's take a leaf out of the Clojure/core approach to solving problems. What is the problem statement here?
If we were only trying to solve the assembly problem, then templates are fine. So there's another element too I'm guessing?
I kinda get the impression we're each looking for different additional properties. I've seen mention of "project-local isolation", "baseline as clj", and "not caring about underlying library".
fwiw, I care more about "baseline as clj" because it's the minimum I can expect anyone to have done, ever. If we're doing training as a company, getting binstubs installed, covering all the distros is more hassle than it's worth for me.
I would probably find it acceptable if a project had some kind of alias like clj -A:tool-name
which would then do the rest for itself. add-lib
is pretty compelling here, as the tool can dynamically fetch it's dependencies as needed.
@alexmiller merged master back to the add-lib
branch and we just added a :deps
alias at work to that SHA so we can use add-lib
in our REPLs. It's nice. I need update my dot-clojure file/repo with that too.
Possibly relevant: https://www.reddit.com/r/Clojure/comments/9tj6d1/katamari_a_clojure_build_tool_a_talk_by_reid/
I uploaded my https://github.com/seancorfield/dot-clojure as a guide for others some time ago -- I think sharing these is useful while the tool is still new.
As for a self-contained project: yes, very important -- it's why we have a shell wrapper that sets CLJ_CONFIG (to point to a repo-specific "dot Clojure" folder) and we have a deps.edn
file for each subpar object in the repo.
Funny I was doing the same yesterday but it seemed like a hack ^
But today, it no longer seems like you are hacking. Today, you are corfielding 🙂
It seems like everybody is going to corfield their deps.edn
sooner or later 😄
If it only goes slightly weird, then .... you are welcome? 🙂
Weird is good. I like weird. :rolling_on_the_floor_laughing:
Back to the CLJ_CONFIG
stuff (I was on my phone earlier)... we've found the ability to specify a "home" deps.edn
via CLJ_CONFIG
is great! It means a project can have a "home" configuration for aliases that provide project-specific tooling as well as :override-deps
(which we rely on heavily to "pin" versions across subprojects within the overall project.
I talked a bit our shell wrapper a week or two back I think. Mostly it takes commands of the form build alias(es) subproject
and it goes into that subproject and runs CLJ_CONFIG=../versions clojure -A:defaults:aliases
(edited to add our defaults
alias -- very important!)
Is that only for aliases?
It does a few mini-DSL-y sort of things around plural aliases or aliases with certain prefix/suffix strings as well as expanding some internal "aliases" but it's only a few tens of lines of shell script.
@alexmiller We have the "pinned" version of Clojure specified as a regular :deps
in that versions/deps.edn
file but everything else is just aliases I think.
Oh, and it adds our Archiva Maven repo as well.
It's definitely shown the need for all deps-based tooling to support correct deps.edn
merging with support for :override-deps
and aliases, if it doesn't just execute in the context of your project's classpath (Depot, for example, already supports aliases but needed a PR to support :override-deps
merging).
It would definitely simplify usage if :override-deps
could be top-level and not need an alias.
@seancorfield fwiw, I don't like the CLJ_CONFIG solution because it takes away the ability to have aliases (e.g. A custom repl) from a user. I understand your choice and think it is pragmatic though.
Yeah, it's a compromise. We have REPL-related aliases in that deps file, as well as other tooling.
What I'd really like would be the ability to specify an extra deps.edn
file easily between user-deps and project-deps.
@alexmiller Is this something you'd entertain as an enhancement? Essentially to support something like <system>/deps.edn
, <user>/deps.edn
, <tooling>/deps.edn
, (project) deps.edn
.
I wasn't sure if you just missed this in the flow of questions in the channel since you didn't comment -- and I sort of expected you to 🙂
Didn’t see it
Don’t know - have been hoping to move towards fewer deps.edn files, not more :)
Fair enough. The underlying t.d.a. lib supports an arbitrary number of deps.edn
files tho'... and it would be nice and generic to surface that in clj
/`clojure` 🙂
You can easily merge extra stuff at the end with -Sdeps
but you can't insert anything before the project deps.edn
which is where I find the need -- and I think I'm not alone.
We can get away with "replacing" the user-deps via CLJ_CONFIG
for our needs but it does mean some duplication and inconvenience.
Other things are pointing away from having an arbitrary number of deps so that’s much more likely to die
But I asked because I’m interested in the use cases
Interesting. I wonder how we'll make things work if that goes away. It's kind of fundamental to our workflow right now.
I guess we'd need to maintain a variant of the clojure
script that allowed us to specify an extra deps file around these lines
# Chain deps.edn in config paths. repro=skip config dir
if "$repro"; then
config_paths=("$install_dir/deps.edn" "deps.edn")
else
config_paths=("$install_dir/deps.edn" "$config_dir/deps.edn" "deps.edn")
fi
config_str=$(printf ",%s" "${config_paths[@]}")
config_str=${config_str:1}
(which part are you saying might "die"? support for CLJ_CONFIG
or support for the --config-files
command line argument in t.d.a.?)
So we'd have <system>/deps.edn
, <user>/deps.edn
, <tooling>/deps.edn
, (project) deps.edn
.
Say, I'm getting this error trying to mvn install
a tools.deps.alpha repo I've got checked out locally, anyone know if there is some special stuff I need to do in order to build it?
[INFO] --- clojure-maven-plugin:1.7.1:test (clojure-test) @ tools.deps.alpha ---
Error: Could not find or load main class clojure.main
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
Can you provide more info? Is there a pom? Did you gen it or make it? What do you mean by a “tools.deps.alpha repo”?
Sure. I just cloned https://github.com/clojure/tools.deps.alpha and ran mvn install
. There is a pom, which I've left unchanged from the repo. I couldn't find any docs about a build process, but I'm sure I could have missed something.
(I get the same error running mvn test
, which makes sense)
Here is the full output:
% mvn install
[INFO] Scanning for projects...
[INFO] Inspecting build with total of 1 modules...
[INFO] Installing Nexus Staging features:
[INFO] ... total of 1 executions of maven-deploy-plugin replaced with nexus-staging-maven-plugin
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building tools.deps.alpha 0.5.461-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- build-helper-maven-plugin:1.12:add-source (add-clojure-source-dirs) @ tools.deps.alpha ---
[INFO] Source directory: /mnt/c/Users/tim/Dropbox/src/cljs/tools.deps.alpha/src/main/clojure added.
[INFO]
[INFO] --- build-helper-maven-plugin:1.12:add-resource (add-clojure-source-dirs) @ tools.deps.alpha ---
[INFO]
[INFO] --- build-helper-maven-plugin:1.12:add-test-source (add-clojure-test-source-dirs) @ tools.deps.alpha ---
[INFO] Test Source directory: /mnt/c/Users/tim/Dropbox/src/cljs/tools.deps.alpha/src/test/clojure added.
[INFO]
[INFO] --- build-helper-maven-plugin:1.12:add-test-resource (add-clojure-test-source-dirs) @ tools.deps.alpha ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ tools.deps.alpha ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /mnt/c/Users/tim/Dropbox/src/cljs/tools.deps.alpha/src/main/resources
[INFO] Copying 18 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.6.0:compile (default-compile) @ tools.deps.alpha ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ tools.deps.alpha ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /mnt/c/Users/tim/Dropbox/src/cljs/tools.deps.alpha/src/test/resources
[INFO] Copying 3 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.6.0:testCompile (default-testCompile) @ tools.deps.alpha ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.17:test (default-test) @ tools.deps.alpha ---
[INFO]
[INFO] --- clojure-maven-plugin:1.7.1:test (clojure-test) @ tools.deps.alpha ---
Error: Could not find or load main class clojure.main
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 11.073 s
[INFO] Finished at: 2018-11-02T19:48:28+00:00
[INFO] Final Memory: 19M/295M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.theoryinpractise:clojure-maven-plugin:1.7.1:test (clojure-test) on project tools.deps.alpha: Clojure failed. -> [Help 1]
Sorry, I could put this all in a ticket too. Just thought I might be missing something obvious.
Ok, so you actually mean tda
No magic here, it is just a maven build and I run mvn test on it all the time
What java version?
Prob needs 8+
% java -version
openjdk version "1.8.0_181"
OpenJDK Runtime Environment (build 1.8.0_181-8u181-b13-1ubuntu0.16.04.1-b13)
OpenJDK 64-Bit Server VM (build 25.181-b13, mixed mode)
% mvn --version
Apache Maven 3.3.9
Maven home: /usr/share/maven
Java version: 1.8.0_181, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-openjdk-amd64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.4.0-17134-microsoft", arch: "amd64", family: "unix"
This is running under ubuntu in the "windows subsystem for linux" which is a bit of a weird environment but all the usual clojure stuff works fine
I’m using Java 11 and Maven 3.5.4 at the moment, but I don’t have any reason to believe your versions are not sufficient
the build box is certainly using much older stuff to build and deploy that lib
works on my machine :)
and the build box :)
try throwing -X -e on your mvn command
I was wondering if I might need to build clojure locally first or something
it’s just using the released clojure 1.9.0
Here's the exception with -X -e:
[ERROR] Failed to execute goal com.theoryinpractise:clojure-maven-plugin:1.7.1:test (clojure-test) on project tools.deps.alpha: Clojure failed. -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.theoryinpractise:clojure-maven-plugin:1.7.1:test (clojure-test) on project tools.deps.alpha: Clojure failed.
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Clojure failed.
at com.theoryinpractise.clojure.AbstractClojureCompilerMojo.callClojureWith(AbstractClojureCompilerMojo.java:464)
at com.theoryinpractise.clojure.AbstractClojureCompilerMojo.callClojureWith(AbstractClojureCompilerMojo.java:366)
at com.theoryinpractise.clojure.ClojureRunTestWithJUnitMojo.execute(ClojureRunTestWithJUnitMojo.java:138)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
... 20 more
It’s failing in the test step, which is kinda weird. You could use -Dmaven.test.skip=true if you wanted to just move past that
Aha! That did it.
it’s failing to run Clojure to run the tests. not sure why that would be
I’ve seen a lot of maven build failures, but I haven’t seen this one :)
My next question was going to be how to run the tests 😉
It's possible that some local modifications I made messed something up, let me try on a clean master
here’s the build box running it: https://build.clojure.org/job/tools.deps.alpha/153/console (Java 8 / Maven 3.2.5)
Hmm, still getting the same thing on a clean master. I'll see if I can repo at home on my mac and file a ticket if so. Thanks for looking.
It works on my Mac. I haven't tried to build/install any Clojure Contrib projects on WSL on my Windows 10 laptop. I'll try to remember to test that later today.
The root of the problem seems to be that I'm getting the clojure dependency with scope provided
.
% mvn dependency:tree | grep org.clojure
[INFO] org.clojure:tools.deps.alpha:jar:0.5.461-SNAPSHOT
[INFO] +- org.clojure:clojure:jar:1.9.0:provided
[INFO] | +- org.clojure:spec.alpha:jar:0.1.143:provided
[INFO] | \- org.clojure:core.specs.alpha:jar:0.1.24:provided
[INFO] +- org.clojure:data.xml:jar:0.2.0-alpha5:compile
[INFO] | \- org.clojure:data.codec:jar:0.1.0:compile
[INFO] +- org.clojure:tools.gitlibs:jar:0.2.64:compile
[INFO] \- org.clojure:tools.cli:jar:0.3.5:compile
Anyways, I'll mess around a bit more and put a ticket up. I'm guessing this is something local to my machine.
interesting. I wonder why that’s different here vs there
@U08QZ7Y5S FYI, if you're relying on WSL, avoid Insider build 18272 -- they broke WSL in that build (they know about it, not sure when a fix will flight tho').
After the October fiasco, I'm avoiding Windows updates altogether for some time
I'm on Fast Ring Insider builds so my WSL is bricked on both my Windows machines. Fortunately, I still have my Mac for dev work! 🙂
FWIW, filed https://dev.clojure.org/jira/browse/TDEPS-105 to track this mishegas. My home mac is sad so I haven't had time to test it there
@U08QZ7Y5S I believe you’re experiencing this, and I feel bad about that, but priority-wise has to fall into my “won’t fix” bucket, so I’m going to decline it. If you manage to find a fix, happy to see it re-opened and consider.
That's totally fine with me, I mostly just wanted to get it documented in case somebody else was seeing it. I have to confess that I have no idea how mvn test
ever works without a concrete clojure.jar in the dependency tree, though.
prob via the clojure maven plugin (which is in the classpath)
I thought of that, but it's not in there: https://github.com/talios/clojure-maven-plugin/blob/clojure-maven-plugin-1.7.1/pom.xml
We have our own, internal, configuration library that can use env vars but mostly relies on EDN files.
I'd enjoy evangelizing aero to you 🙂 Any big differences between aero and your system?
I'd have to go look at Aero again. We did a review of pretty much everything available out there when we decided to "roll our own" a while back...
We've considered open sourcing it, but it does contain some proprietary stuff that we haven't had time (or inclination) to refactor out yet.
If I have this in my :deps
:
compute/integrations {:git/url "[email protected]:ComputeSoftware/integrations.git"
:sha "e0b915e5e9b285d322b6d01231d8e4e468550d76"
:exclusions [commons-logging/commons-logging]}
And I run clj -Stree -Sforce
, I get this:
compute/integrations [email protected]:ComputeSoftware/integrations.git e0b915e
com.amazonaws/aws-java-sdk-autoscaling 1.11.399
com.amazonaws/aws-java-sdk-sts 1.11.399
com.cognitect/anomalies 0.1.12
clj-http/clj-http 3.9.1
org.apache.httpcomponents/httpasyncclient 4.1.3
org.apache.httpcomponents/httpcore-nio 4.4.6
slingshot/slingshot 0.12.2
org.apache.httpcomponents/httpcore 4.4.9
org.apache.httpcomponents/httpclient-cache 4.5.5
org.apache.httpcomponents/httpclient 4.5.5
commons-logging/commons-logging 1.2
Why is commons-logging/commons-logging
included?dunno, that’s weird
feel free to file a ticket with a repro if you can slim it down
it being under a git dep might be part of the answer, not sure
First cut at the obvious repro case and I cannot reproduce. I made a git repo with a deps.edn that has clj-http as the dep. I made directory with a deps.edn on my computer that added that lib as a dep with the commons-logging exclusion and it behaved correctly. Is there something else I should be looking for in my current problem case that may shed some light here?
If I add that exact dependency to my new project:
{:deps {compute/integrations {:git/url "[email protected]:ComputeSoftware/integrations.git"
:sha "e0b915e5e9b285d322b6d01231d8e4e468550d76"
:exclusions [commons-logging/commons-logging]}}}
commons-logging is not in the tree, as expected.Ok this is bizarre. After running Never mind, I searched the wrong terminal output.clj -Stree
in my original project after making no changes, I no longer have this issue. I ran clj -Stree -Sforce
before so I would've thought that would cover any caching issues.
This dep excludes httpclient, as expected.
compute/integrations {:git/url "[email protected]:ComputeSoftware/integrations.git"
:sha "e0b915e5e9b285d322b6d01231d8e4e468550d76"
:exclusions [org.apache.httpcomponents/httpclient]}
Removing all other deps in my project besides Clojure and compute/integrations
causes the exclusion to work correctly.
Got a repro. There is something seriously funky going on. Repro is here: https://github.com/kennyjwilli/clj-exclusions. cd into the app
directory and run clj -Stree -Sforce
. I get this:
org.clojure/clojure 1.9.0
org.clojure/core.specs.alpha 0.1.24
org.clojure/spec.alpha 0.1.143
integrations/integrations ..
clj-http/clj-http 3.9.1
commons-codec/commons-codec 1.11
org.apache.httpcomponents/httpasyncclient 4.1.3
org.apache.httpcomponents/httpcore-nio 4.4.6
slingshot/slingshot 0.12.2
commons-io/commons-io 2.6
org.apache.httpcomponents/httpcore 4.4.9
org.apache.httpcomponents/httpclient-cache 4.5.5
org.apache.httpcomponents/httpclient 4.5.5
commons-logging/commons-logging 1.2
potemkin/potemkin 0.4.5
clj-tuple/clj-tuple 0.2.2
riddley/riddley 0.1.12
org.apache.httpcomponents/httpmime 4.5.5
com.amazonaws/aws-java-sdk-cloudwatch 1.11.399
com.amazonaws/jmespath-java 1.11.399
com.fasterxml.jackson.core/jackson-databind 2.6.7.1
com.fasterxml.jackson.core/jackson-core 2.6.7
com.fasterxml.jackson.core/jackson-annotations 2.6.0
com.amazonaws/aws-java-sdk-core 1.11.399
joda-time/joda-time 2.8.1
com.fasterxml.jackson.dataformat/jackson-dataformat-cbor 2.6.7
software.amazon.ion/ion-java 1.0.2
Now if I change the name of the dependency from integrations
to lib
, I get this output from clj -Stree -Sforce
:
org.clojure/clojure 1.9.0
org.clojure/core.specs.alpha 0.1.24
org.clojure/spec.alpha 0.1.143
com.amazonaws/aws-java-sdk-cloudwatch 1.11.399
com.amazonaws/jmespath-java 1.11.399
com.fasterxml.jackson.core/jackson-databind 2.6.7.1
com.fasterxml.jackson.core/jackson-core 2.6.7
com.fasterxml.jackson.core/jackson-annotations 2.6.0
com.amazonaws/aws-java-sdk-core 1.11.399
joda-time/joda-time 2.8.1
com.fasterxml.jackson.dataformat/jackson-dataformat-cbor 2.6.7
software.amazon.ion/ion-java 1.0.2
org.apache.httpcomponents/httpclient 4.5.5
commons-logging/commons-logging 1.2
lib/lib ..
clj-http/clj-http 3.9.1
commons-codec/commons-codec 1.11
org.apache.httpcomponents/httpasyncclient 4.1.3
org.apache.httpcomponents/httpcore-nio 4.4.6
slingshot/slingshot 0.12.2
commons-io/commons-io 2.6
org.apache.httpcomponents/httpcore 4.4.9
org.apache.httpcomponents/httpclient-cache 4.5.5
potemkin/potemkin 0.4.5
clj-tuple/clj-tuple 0.2.2
riddley/riddley 0.1.12
org.apache.httpcomponents/httpmime 4.5.5
It is different and all I did was change the name. What is going on here?the ordering is somewhat dependent on traversal order as to which one is encountered first, but you shouldn’t be getting a dep that is excluded
there are a couple tickets out there that I’ve looked at and there are a couple issues to resolve - it’s likely this is the same as one of them
They're only different because org.apache.httpcomponents/httpclient
is coming in via two dependencies, not just one.
In the integrations
case, httpclient and logging come in via clj-http. In the lib
case, httpclient and logging are coming in via aws cloudwatch (via aws core)
TDEPS-58 (and TDEPS-79)
If you have the exclusion on clj-http, it won't stop it being pulled in if the cloudwatch dep is walked first -- since it won't have seen the exclusion at that point.
We've had to be very aggressive with exclusions to stop up all the "holes" where certain things leak in...
there have been some requests for “global” exclusions
I’m not necessarily opposed to that, but haven’t thought through all the implications
Yes. We've had to add the same/similar exclusions on several deps across our subprojects in order to completely "hide" them.
We've used global exclusions with Boot. It's a bit of a sledgehammer. We used it to exclude Clojure and ClojureScript across everything.
Yes, global exclusions would "solve" the problem but it's really a huge hammer to crack a little nut. And the fall out is that you then need to ensure you bring in all those things explicitly in the right subprojects -- which is a pain.
seems like that would make it hard to use Clojure or ClojureScript :)
You can bring them in at the top-level. It just ensures nothing else brings them in.
so I’d say that’s global-except-at-top-level :)
Yeah, well, Boot is nothing if not "pragmatic" 🙂
I’m just saying, that’s a subtlety
with Maven dependency, no
Maven takes the first version it encounters
Two things: 1. we wanted ClojureScript excluded completely for all our backend projects, 2. we run "pedantic" style checks (or, at least, we did in lein
and boot
) so if potentially conflicting versions came in, we would get an exception -- and we didn't want to add those exclusions to nearly every Clojure dependency, since everything depends on different versions of Clojure out there 🙂