Fork me on GitHub
#tools-deps
<
2021-08-26
>
henryw37410:08:19

We have this problem where tools.deps is using its cache for :local/root dependencies, but the cache is out of date. This happens sometimes when switching git branch for example Deleting .cpcache fixes the problem is there a way we can disable caching of local/root deps, or disable it altogether? (aside from deleting the cache file every time ofc). thanks

henryw37410:08:33

thanks. will try that

Eugen16:08:34

hi, I'm trying to know what is the clojure way (deps.edn ?!) of publishing some files (json. data files) to a private maven repository and download that file so we can build a docker image from multiple dependencies. In gradle fpr example I can set tasks to download a set of dependencies to a specific directory and then process them for use in a zip distribution.

hiredman18:08:12

you may need to back up and kind of untangle some things

hiredman18:08:08

tools-deps downloads artifacts (jars) from maven repos and assembles them into a classpath and launches clojure with that classpath

hiredman18:08:52

maven repos are for storing artifacts (jars, maybe some metadata about jars) not for storing random json

hiredman18:08:07

if it isn't random json, but some data some code needs access to, that often lives in resources/ in your project, and gets bundled into your jar along with your code and published to wherever, so you don't need to download it separately, it is baked in

Eugen19:08:29

it's data - queries for a load test - that we generate via an app from the db. We update them once per quarter and I use them in a locust test (I build a docker image). They are too big IMO (15MB) to be stored in git so IMO the best place to put them is in a binary repo - we have a private instance. I don't want to put them in S3 because I will need to give people access there as well and it complicates things.

Eugen19:08:53

I'm looking to use tools.build to package them as a zip and probably call maven to upload them to the repo

Eugen19:08:59

I did find an issue while following the guide at https://clojure.org/guides/tools_build .

{:paths ["src"]
 :deps {org.clojure/clojure {:mvn/version "1.10.3"}
        org.clojure/core.async {:mvn/version "1.3.618"}
        com.stuartsierra/component {:mvn/version "1.0.0"}
       ;;  io.github.clojure/tools.build {:git/tag "v0.1.9" :git/sha "6736c83"}
        }
 :aliases
 {:build {:deps {io.github.clojure/tools.build {:git/tag "v0.1.9" :git/sha "6736c83"}}
          :ns-default ro.ieugen.training.tools-build-guide}}}
ieugen@daos-495:~/.../clojure/clojure-training$ clj -T:build clean
Execution error (FileNotFoundException) at clojure.run.exec/requiring-resolve' (exec.clj:35).
Could not locate ro/ieugen/training/tools_build_guide__init.class, ro/ieugen/training/tools_build_guide.clj or ro/ieugen/training/tools_build_guide.cljc on classpath. Please check that namespaces with dashes use underscores in the Clojure file name.

Full report at:
/tmp/clojure-4875866060227779231.edn
and
ls -la src/ro/ieugen/training/tools_build_guide.clj
-rw-r--r-- 1 ieugen ieugen 1299 Aug 26 22:05 src/ro/ieugen/training/tools_build_guide.clj
ieugen@daos-495:~/.../clojure/clojure-training$ clojure --version 
Clojure CLI version 1.10.3.943

Eugen19:08:19

if it's usefull, I pushed the code that fails for me https://github.com/ieugen/clojure-training/

Alex Miller (Clojure team)19:08:13

-T will remove your project :paths and :deps, so you'll want to add either :paths ["src"] or :extra-paths ["src"] in your :build alias

Alex Miller (Clojure team)19:08:25

(doesn't really matter which)

Alex Miller (Clojure team)19:08:41

also, btw there is a #tools-build for future q's

👍 3
Eugen19:08:31

thanks, that's missing in the guide online - so most people following the guide will probably fail like me

Alex Miller (Clojure team)19:08:32

often people put their build script in a different src dir (the project root is automatically included)

Alex Miller (Clojure team)19:08:23

oh, that's because I'm assuming it's in the root of the project, which is added by -T

Alex Miller (Clojure team)19:08:35

but this is worth explaining for sure

Eugen19:08:18

yes. it would help to explain. in my case, I'm not in the root of the project ?!

Alex Miller (Clojure team)19:08:49

you have your build script under src/yada/yada

Alex Miller (Clojure team)19:08:30

but if you put your tools_build_guide.clj next to the deps.edn, you could do that instead

Alex Miller (Clojure team)19:08:52

I logged this as https://github.com/clojure/clojure-site/issues/550 so I can improve the next time I do doc work

Eugen19:08:58

ok, now I get it now - I was confused a bit

Alex Miller (Clojure team)19:08:33

you're right - it needs explanation! :)

Eugen19:08:03

do you think I can take a shot at that?

Alex Miller (Clojure team)20:08:02

you can, but I'm likely to edit it :)

Eugen20:08:18

I don't mind that. I'll see if I get to it before you do.