in deps.edn, is it possible to have one alias include another?
@millettjon You can have an alias include directories from another like so:
:aliases {:foo-paths ["src"] :some-alias {:extra-paths [:foo-paths "some-alias-path"]}}
For including dependencies, there's a JIRA for that and you might be able to vote on it there if you have an account.
are you sure?
clj -Sdeps '{:paths ["foo"] :aliases {:foo {:extra-paths ["bar"]} :bar {:extra-paths [:foo "baz"]}}}' -A:bar -Spath
=> baz:foo:...
without paths from alias :fooLooks like this is the JIRA ticket: https://clojure.atlassian.net/browse/TDEPS-170
@delaguardo You changed my example :)
Thanks. I would use both in this case.
is there a way to tell cli where to search for maven settings.xml
? maven allows to override the location with -s (ex: mvn -s myptah/settings.xml install
)
@dominicm right, I didn’t know that you can have a vector of strings as a value for alias keyword. Not sure if this is a part of official api thought
Huh, is this new?
And does it work or not? I see conflicting evidence with @delaguardo's example?
:aliases {:foo ["X"]
:bar {:extra-paths [:foo "Y"]}
is working
clj -Sdeps '{:aliases {:foo ["X"] :bar {:extra-paths [:foo "Y"]}}}' -Srepro -A:bar -Spath
=> X:Y:...
but it also is not valid acording the spec in tools.deps.alpha — https://github.com/clojure/tools.deps.alpha/blob/master/src/main/clojure/clojure/tools/deps/alpha/specs.cljI can see the jira ticket but don't see how to vote. Maybe I don't have the right access?
Yeah I didn't see it mentioned anywhere but this is the second time I have wanted to use include functionality.
That is a common issue with JIRA. It sucks.
@delaguardo this is part of the official API, yes.
This is new in tools deps
do you know where this declared? Can’t find it in cli guide or reference
also (if this is new) when it was introduced?
nwm, found it in changelog
when?
in 0.9.745
• Added support for using data stored in aliases as :paths
do you have a link to the changelogs? I never know where to look: in brew install clojure or tools-deps?
https://github.com/clojure/tools.deps.alpha/blob/master/CHANGELOG.md
but this is soooo confusing
clj -Sdeps '{:aliases {:foo ["x"]}}' -A:foo -Spath
=> "src:..."
seems like this isn’t working in that caseI would have never guessed that > Added support for using data stored in aliases as :paths this would mean the above
same
no
if you want to file an https://ask.clojure.org request for that, I don't think we have any such question/ticket right now
Will do ! thanks @alexmiller
I have a question -
should this clj -Sdeps '{:aliases {:foo ["x"]}}' -A:foo -Spath
work the same as clj -Sdeps '{:aliases {:foo {:extra-paths ["x"]}}}' -A:foo -Spath
?
right now I’m getting different results. In first case there is no “x” in my path
the first is not a thing
not sure what you're expecting there?
unless you do
clj -Sdeps '{:paths [:foo] :aliases {:foo ["x"]}}' -A:foo -Spath
just curiosity
as an example this clj -Sdeps '{:aliases {:foo ["x"] :bar {:extra-paths [:foo]}}}' -A:bar -Spath
is working wierdly
as it should
that is what I found today in the slack thread was surprised because can’t remember mention of that in cli guide or reference also specs in tools.deps.alpha is not allowing such aliases neither as in API.md
there is an example in https://clojure.org/reference/deps_and_cli#_paths but may be under-doc'ed :)
specs may be lagging
looks like :aliases become a little bit overloaded key
not overloaded at all, just very generic. an alias is a name for a data structure.
and this data now is context specific + depend on it’s shape, isn’t it?
dependent on how you want to use it, it's just data
sure, but this clj -Sdeps '{:aliases {:foo "x"}}' -A:foo -Spath
will throw
clj -Sdeps '{:aliases {:foo "x"}}' -A:foo -Spath
Error building classpath. nth not supported on this type: Character
java.lang.UnsupportedOperationException: nth not supported on this type: Character
this exception is telling me that data is used in a context hidden from me. So for me this is not just datawell, I'd say that's a bug
should either be ignored or have a better error in that case, feel free to log at http://ask.clojure.org
sure, I will report it
btw, this clj -Sdeps '{:paths [:foo] :aliases {:foo "x"}}' -Spath
doesn’t give me an exception
iirc, it flattens so it's little loosey goosey about the colls there atm, still deciding what to allow
I have an issue bringing in a .jar that relies on a pom.xml that relies on Dropwizard. Having a little trouble figuring out where the issue really lies. clj -Spath
gives me this error for all the .jar's dependencies: [ERROR] Failed to determine Java version for profile....
I can run the jar just fine with plain old Java. It only becomes a problem when I try to bring it into my project. Here it is in my deps.edn
: com.plaid/quickstart {:local/root "src/usermanager/java/target/quickstart-1.0-SNAPSHOT.jar"}
The docs tell me this is the right behavior ("If the jar includes a pom.xml file, it will be used to find transitive deps"). FWIW, each dependency is enumerated thusly: <groupId>io.dropwizard</groupId>
, <artifactId>dropwizard-bom</artifactId>
, <version>${dropwizard.version}</version>
. With the version of Dropwizard resolving as 1.3.2. That what it seems to be choking on, based on the error.
Should I just build my own uberjar?
resolving pom files is kind of a pain in the ass (super poms, variables, env vars, etc) - it is certainly possible for the pom inside a jar to be insufficient to actually resolve the dep set
Well, I have the source. So I can roll it again. Maybe that's the easiest way? this .jar came in the repository.
@delaguardo There's an example in the docs of this https://clojure.org/reference/deps_and_cli#_paths
if you have a concrete repro, would be happy to see a question on https://ask.clojure.org with that so I can look at it. at the very least, would like to fail gracefully and let you supply those deps explicitly.
Debugging it from the clojure side seems pretty silly if it's not immediately obvious what's going wrong.
{:paths [:clj-paths :resource-paths]
:aliases
{:clj-paths ["src/clj" "src/cljc"]
:resource-paths ["resources"]}}
Here are the CLI release notes: https://clojure.org/releases/tools
I do. It's Plaid's API Java code... so it's also something that isn't too obscure.
"Failed to determine Java version for profile" means that there is a maven profile that uses maven's Java version stuff (lets you select per-java version deps)
I can put the question there. I'll have to give a bit of a think of how to phrase it succinctly.
I think maybe that requires JAVA_HOME env var
you could try setting that and seeing if it works
Ah, I see Alex linked you to the same example in the docs (but at least the CLI releases link is new to this thread).
Got it. I'll play a little more and post something on http://ask.clojure.org. Thanks @alexmiller!
yes, this one is new, thanks!
You can also use aliases for :exec-args
to point to a data structure that is then used as the arguments to the :exec-fn
as a complete replacement of exec-args? like :exec-args :one-of-aliases
?
So far those are the only two places where the CLI/t.d.a itself allows/uses aliased data. Yes, like that.
(the :exec-args
usage is not documented on that page, unfortunately)
With the Clojure basis available to any program run from the CLI, you can also read the merged deps.edn
data and access aliased data inside your program at runtime.
I wish to have ability to provide custom data literals for deps.edn reader. then those tiny references to data in aliases can be colored as #aliases/ref :some-alias
and allows to be used as a partial replacement for exec-args
without this twick it is hard to say what is going on here :paths [:foo "bar"]
without reading documentation (with blanks 😞 )
Feel free to post requests to improve the docs on http://ask.clojure.org -- or if you've signed the Contributor's Agreement, you could submit PRs directly to https://github.com/clojure/clojure-site/pulls (but probably best to discuss with @alexmiller first to see how he'd like this clarified). Suggestions for changing the deps.edn
file format itself can go on http://ask.clojure.org