Does tools-deps support specifying version ranges? I couldn’t see anything about it. It looks like it supports it when reading a POM as a transitive dependency
I'm pretty sure it doesn't
By design
I'm lying https://github.com/clojure/tools.deps.alpha/blob/0ceb075c24ce28d4ec22027aa141cb19baad1b69/src/main/clojure/clojure/tools/deps/alpha/extensions/maven.clj apparently support was added
It just gets the highest version in the range
I have put my aliases in the ~/.clojure/deps.edn file (I am suing the dot file from seancorfield), but when I try to call clj -A:new app test/one
, I get the following error -
Execution error (FileNotFoundException) at java.io.FileInputStream/open0 (FileInputStream.java:-2).
app (No such file or directory)
Full report at:
/tmp/clojure-3392454598929432067.edn
It seems it is not able to find the alias, because when I inline the alias and call the command it works. Why is it not recognizing the ~/.clojure/deps.edn file ?@murtaza52 Did you also get this WARNINg about that error message?
WARNING: Specified aliases are undeclared: [:new]
What does clojure -Sdescribe
show for you?~ >>> clojure -Sdescribe [1]
{:version "1.10.1.536"
:config-files ["/usr/local/lib/clojure/deps.edn" "/home/murtaza52/.config/clojure/deps.edn" ]
:config-user "/home/murtaza52/.config/clojure/deps.edn"
:config-project "deps.edn"
:install-dir "/usr/local/lib/clojure"
:config-dir "/home/murtaza52/.config/clojure"
:cache-dir "/home/murtaza52/.config/clojure/.cpcache"
:force false
:repro false
:resolve-aliases ""
:classpath-aliases ""
:jvm-aliases ""
:main-aliases ""
:all-aliases ""}
@seancorfield No I did not get that warning
I moved the file /.clojure/deps.edn to /.config/clojure/deps.edn, but I am still getting the same output as above.
How did you install the Clojure CLI tools? I've never seen it try to use ~/.config/clojure
as the user-level location...
What O/S is this on? What is your HOME
environment variable? (`echo $HOME`)
~ >>> echo $HOME /home/murtaza52
this is caused by xdg-config stuff on linux right
This is manjaro linux
@seancorfield https://github.com/borkdude/deps.clj/blob/5d51b80176bdcb96927ce5e6aedb25581db0e2e0/src/borkdude/deps.clj#L341
sorry I m still lost, how should I fix it ? where does that deps.clj go ?
It's a separate tool. He's just showing that the XDG thing is a problem.
this is a new install of manjaro without a DE, I had installed it before with DE and it worked fine.
yeah, I should point to the bash script, this is a clojure port of it
can you do echo $XDG_CONFIG_HOME
?
this one just bspwm as the tiling manager
~ >>> echo $XDG_CONFIG_HOME /home/murtaza52/.config
and then try with the -Sforce
with your changes in place
yes, so it will look for /home/.../.config/clojure/deps.edn
but in already has a dir called /.config/clojure , should I replace it with /.config/.clojure ?
no sorry, without the dot, it was a typo on my behalf
and then re-try your action with -Sforce
what does sforce do ? yes it worked !
it ignores a cached file
cool thanks !
New topic: tools.deps.alpha
ignores :scope
in a coordinate, yes? That's a Maven thing that Lein/Boot support but is not relevant for deps.edn
...?
Hahaha... well, someone opened a bug against depstar
about it putting :scope "provided"
dependencies into the JAR and when I created a quick test to check the classpath clojure -Spath
in a new project with a :scope "provided"
dependency, yes, it's on the classpath so this is t.d.a behavior.
hello. I'm trying to use git deps with aws codecommit, inside a ec2 instance but I get
Error building classpath. <https://git-codecommit.us-east-1.amazonaws.com/v1/repos/my-clojure-code>: Authentication is required but no CredentialsProvider has been registered
but when I (inside the ec2 instance) git clone <https://git-codecommit.us-east-1.amazonaws.com/v1/repos/my-clojure-code>
it works
Anyone else using tools_deps + codecommit?
(stacktrace on comment)
Cloning: <https://git-codecommit.us-east-1.amazonaws.com/v1/repos/my-clojure-code>
Error building classpath. <https://git-codecommit.us-east-1.amazonaws.com/v1/repos/my-clojure-code>: Authentication is required but no CredentialsProvider has been registered
org.eclipse.jgit.api.errors.TransportException: <https://git-codecommit.us-east-1.amazonaws.com/v1/repos/my-clojure-code>: Authentication is required but no CredentialsProvider has been registered
at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:248)
at org.eclipse.jgit.api.CloneCommand.fetch(CloneCommand.java:306)
at org.eclipse.jgit.api.CloneCommand.call(CloneCommand.java:200)
at org.eclipse.jgit.api.CloneCommand.call(CloneCommand.java:89)
at clojure.tools.gitlibs.impl$call_with_auth.invokeStatic(impl.clj:50)
at clojure.tools.gitlibs.impl$call_with_auth.invoke(impl.clj:41)
at clojure.tools.gitlibs.impl$git_clone_bare.invokeStatic(impl.clj:71)
at clojure.tools.gitlibs.impl$git_clone_bare.invoke(impl.clj:68)
at clojure.tools.gitlibs.impl$ensure_git_dir.invokeStatic(impl.clj:110)
at clojure.tools.gitlibs.impl$ensure_git_dir.invoke(impl.clj:100)
at clojure.tools.gitlibs$resolve.invokeStatic(gitlibs.clj:33)
at clojure.tools.gitlibs$resolve.invoke(gitlibs.clj:29)
at clojure.tools.gitlibs$procure.invokeStatic(gitlibs.clj:47)
at clojure.tools.gitlibs$procure.invoke(gitlibs.clj:41)
at clojure.tools.deps.alpha.extensions.git$eval999$fn__1001.invoke(git.clj:41)
at clojure.lang.MultiFn.invoke(MultiFn.java:239)
at clojure.tools.deps.alpha$expand_deps.invokeStatic(alpha.clj:189)
at clojure.tools.deps.alpha$expand_deps.invoke(alpha.clj:169)
at clojure.tools.deps.alpha$resolve_deps.invokeStatic(alpha.clj:237)
at clojure.tools.deps.alpha$resolve_deps.invoke(alpha.clj:217)
at clojure.tools.deps.alpha.script.make_classpath2$create_classpath.invokeStatic(make_classpath2.clj:55)
at clojure.tools.deps.alpha.script.make_classpath2$create_classpath.invoke(make_classpath2.clj:47)
at clojure.tools.deps.alpha.script.make_classpath2$run_core.invokeStatic(make_classpath2.clj:81)
at clojure.tools.deps.alpha.script.make_classpath2$run_core.invoke(make_classpath2.clj:72)
at clojure.tools.deps.alpha.script.make_classpath2$run.invokeStatic(make_classpath2.clj:101)
at clojure.tools.deps.alpha.script.make_classpath2$run.invoke(make_classpath2.clj:95)
at clojure.tools.deps.alpha.script.make_classpath2$_main.invokeStatic(make_classpath2.clj:146)
at clojure.tools.deps.alpha.script.make_classpath2$_main.doInvoke(make_classpath2.clj:118)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.lang.Var.applyTo(Var.java:705)
at clojure.core$apply.invokeStatic(core.clj:665)
at clojure.main$main_opt.invokeStatic(main.clj:514)
at clojure.main$main_opt.invoke(main.clj:510)
at clojure.main$main.invokeStatic(main.clj:664)
at clojure.main$main.doInvoke(main.clj:616)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.lang.Var.applyTo(Var.java:705)
at clojure.main.main(main.java:40)
Caused by: org.eclipse.jgit.errors.TransportException: <https://git-codecommit.us-east-1.amazonaws.com/v1/repos/my-clojure-code>: Authentication is required but no CredentialsProvider has been registered
at org.eclipse.jgit.transport.TransportHttp.connect(TransportHttp.java:530)
at org.eclipse.jgit.transport.TransportHttp.openFetch(TransportHttp.java:345)
at org.eclipse.jgit.transport.FetchProcess.executeImp(FetchProcess.java:137)
at org.eclipse.jgit.transport.FetchProcess.execute(FetchProcess.java:123)
at org.eclipse.jgit.transport.Transport.fetch(Transport.java:1269)
at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:237)
... 37 more
jgit may not support whatever authentication method git is using there
you need to use ssh auth, not https
https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_ssh-keys.html To use ssh, i need to create a key and autorize it. That's the path @ghadi?
yes
and put the key in an ssh-agent
If I am using a template to generate a project, and the template has changed, will just using -Sforce force the new template to be retrieved ?
No. The template is only used when the project is first created.
After that, it's just "your project" and no longer related to the template.
nope want to create a new project with the template, and the template was recently updated, how do I ensure that the updated template from clojars will be pulled for the new project ?
By default, clj-new
always uses the most recent stable version of a template.
Per the clj-new
documentation (README), you can override that behavior:
-S or --snapshot -- look for -SNAPSHOT version of the template (not just a release version)
-v or --verbose -- enable debugging -- be verbose! -vv and -vvv are increasingly verbose
-V or --version, followed by a version -- use this specific version of the template
cool thanks
@ghadi that't not aplicable once I'm trying to use LaunchConfig
@seancorfield I'm trying to debug the template @murtaza52 is using - is there a way to determine what clj-new will interpret as the "most recent version" I read through this: https://docs.oracle.com/middleware/1212/core/MAVEN/maven_version.htm#MAVEN8855 and this answer (https://stackoverflow.com/questions/13004443/how-does-maven-sort-version-numbers) led me to org.apache.maven.artifact.versioning.ComparableVersion I tried deploying new versions that I confirmed ComparableVersion should sort as "new" but I'm not seeing them when I try using the template
@danvingo It will use whatever version t.d.a. would select if it were a dependency with a "RELEASE"
version.
What is the template you're trying to work with?
I wanted to use dates as the versions... I'm just learning about the wonderful world of maven version semantics
I posted the options above that would let you do that.
When I tried it -- having never looked at that template before -- here's what I got:
(! 709)-> clj -A:new dv.fulcro-template dvingo/example -vvv
Downloading: dv/fulcro-template/clj-template/maven-metadata.xml from clojars
Output from locating template:
Downloading: dv/fulcro-template/clj-template/2020-06-25-4/clj-template-2020-06-25-4.pom from clojars
Downloading: dv/fulcro-template/clj-template/2020-06-25-4/clj-template-2020-06-25-4.jar from clojars
Generating fresh 'clj new' dv.fulcro-template project.
ah thank you! sorry I overlooked that
And here's how to pull down specific versions:
(! 714)-> clj -A:new dv.fulcro-template dvingo/example -V 2020-06-25-4
Generating fresh 'clj new' dv.fulcro-template project.
Thu Jun 25 15:09:24
(sean)-(jobs:0)-(~/clojure)
(! 715)-> clj -A:new dv.fulcro-template dvingo/example2 -V 2020.06.3
Generating fresh 'clj new' dv.fulcro-template project.
Thu Jun 25 15:09:55
(sean)-(jobs:0)-(~/clojure)
(! 716)-> clj -A:new dv.fulcro-template dvingo/example3 -V 2020-06-25-3
Generating fresh 'clj new' dv.fulcro-template project.
Thu Jun 25 15:10:29
(sean)-(jobs:0)-(~/clojure)
(! 717)-> clj -A:new dv.fulcro-template dvingo/example1 -V 1.0.0
Generating fresh 'clj new' dv.fulcro-template project.
Thu Jun 25 15:10:41
(sean)-(jobs:0)-(~/clojure)
(! 718)->
hmm, I'm on a machine that has prior versions of the template in .m2 and I'm not seeing what you're seeing:
$ clj -A:new dv.fulcro-template dvingo/example -vvv
Output from locating template:
Generating fresh 'clj new' dv.fulcro-template project.
Well, you won't see any output if it doesn't have to download anything.
It at some point stopped downloading the newest versions:
Thu Jun 25, 2020 18:05:15:~/.m2/repository/dv/fulcro-template/clj-template ()
$ l
total 24
drwxr-xr-x 9 default staff 288B Jun 25 18:12 ./
drwxr-xr-x 5 default staff 160B Jun 3 13:01 ../
drwxr-xr-x 7 default staff 224B Jun 23 21:47 2020-06-23-2/
drwxr-xr-x 7 default staff 224B Jun 25 13:31 2020-06-24/
drwxr-xr-x 7 default staff 224B Jun 25 13:56 2020-06-25/
drwxr-xr-x 7 default staff 224B Jun 25 14:05 2020-06-25-2/
-rw-r--r-- 1 default staff 918B Jun 25 14:05 maven-metadata-clojars.xml
-rw-r--r-- 1 default staff 40B Jun 25 14:05 maven-metadata-clojars.xml.sha1
-rw-r--r-- 1 default staff 280B Jun 25 18:12 resolver-status.properties
I think t.d.a. only checks once per day for releases.
ahhh, ok
It's very unusual to have multiple releases on the same day. Even with snapshots.
If you blow away ~/.m2/repository/dv/fulcro-template/clj-template
then it should download whatever is the latest version.
yea that makes sense to save time for the usual case. I wasn't aware of how the interaction with maven occurred - thanks for the help! deleting the dir from the .m2 repo made it pull the latest
Yup, that 🙂
Like I said above, you can always use the -V
/ --version
option to download a specific version.
right -thanks again!
You may be able to use a version range like this -V '[0,)'
but, again, Aether (the Maven-stuff underneath t.d.a.) may only check once a day.
(FWIW, I downloaded 2020-06-25-2
per your directory listing above, then used [0,)
and it did pull down 2020-06-25-4
... @danvingo
So it may be that the range checks every time? (maybe a Maven expert can confirm/deny that?)
gotcha - my main use case is template users and not wanting to have them specify versions i'll just use ComparableVersion at the repl before sending a new version 🙂
(hard to tell -- having pulled down the -2 version, running it without a version still pulled down -4 for me, based on RELEASE
instead)
If you're not doing more than one release a day, I suspect you won't have a problem 🙂
perfect, thanks!
One final thing @danvingo if you use the -S
option, it uses a version range of (0.0.0,)
ahh good to know. I think the convention I wanted to use is working - 2020-06-25 compares -1 to 2020-06-25-1 and 2020-06-25-1 comes before 2020-06-25-2 so looks like the issue was maven not being checked by t.d.a. and not version sorting
This is partly why I've moved to MAJOR.MINOR.COMMITS so I don't have to worry about that. COMMITS is always increasing.
makes sense - I just want to do my part to help kill semantic(less) versioning (I know you're not following that, per the note in the readme, but it still follows the syntax)
Agreed. There are plenty of ways to do it. YYYY-MM-DD.SEQ is as good as any -- and there are plenty of libraries out there, even in the Java world, that use date/time versions instead of semantic(less) versioning (I like that term... Imma gonna stealz it!)