boot-clj / boot

Build tooling for Clojure.
https://boot-clj.github.io/
Eclipse Public License 1.0
1.75k stars 182 forks source link

Move boot.aether/default-repositories to boot.pod #592

Closed arichiardi closed 5 years ago

arichiardi commented 7 years ago

Hello folks!

Sometimes you want to use it when creating pods, for instance I have recently used this way:

(def ^:dynamic
  *pod-env*
  "The pod env, it can be dynamically changed before the first task call
  to run-local if necessary."
  {:name "dynamodb-pod"
   :dependencies '[[arichiardi/boot-dynamodb "0.1.0-SNAPSHOT"]
                   [camel-snake-kebab "0.4.0" :scope "test"]
                   [com.amazonaws/DynamoDBLocal "[1.11,2.0)"]
                   #_[com.almworks.sqlite4java/sqlite4java "1.0.392"]]
   :local-repo (:local-repo (boot/get-env))
   :repositories  (conj @aether/default-repositories
                        ["dynamodb-local-oregon" {:url "https://s3-us-west-2.amazonaws.com/dynamodb-local/release"}])})

...make-pod...

There is probably a reason why it is not in boot.core or boot.pod already, but it would be nice to have somewhere without having to specify a dependency on boot/aether.

I mainly opened this issue to be told: "you can go this other way" :smile:

hit023 commented 7 years ago

Could someone( @arichiardi ) please elaborate on the issue; to a newcomer?

arichiardi commented 7 years ago

So the issue is very simple, default-repositories should imho go in boot.core or at least in boot.pod, because user code would want to include it at configuration time without the need of importing an additional dependency (boot.aether) just for referring to a var. This is a breaking change though, so I was looking for other opinions as well.

Deraen commented 7 years ago

In your example code you could just append custom repositories to (:repositories (get-env))? I think it is best for pods to include the repositories configured for the project?

arichiardi commented 7 years ago

Uhm, not sure I get it, I am creating a pod there and need to specify a custom repo, which I am building, am I missing something?

Deraen commented 7 years ago
boot.user=> (:repositories (boot.core/get-env))
[["clojars" {:url "https://repo.clojars.org/", :username "bar", :password "foo"}] ["maven-central" {:url "https://repo1.maven.org/maven2"}]]
boot.user=> (conj (:repositories (boot.core/get-env)) ["dynamodb-local-oregon" {:url "https://s3-us-west-2.amazonaws.com/dynamodb-local/release"}])
[["clojars" {:url "https://repo.clojars.org/", :username "foo", :password "bar"}] ["maven-central" {:url "https://repo1.maven.org/maven2"}] ["dynamodb-local-oregon" {:url "https://s3-us-west-2.amazonaws.com/dynamodb-local/release"}]]

(Btw. it is quite dangerous solution to always add credentials to repository maps...)

arichiardi commented 7 years ago

Oh ok now I get it. It felt a bit better to use the default repos and completely override what boot gives me in the first place at runtime. Just wiping out everything basically. I guess your solution would have worked as well very well.

burn2delete commented 5 years ago

closing as the correct way to do this is by modifying the env.