tools-deps

Discuss tools.deps.alpha, tools.build, and the clj/clojure command-line scripts! See also #depstar #clj-new
danielcompton 2020-06-25T09:19:35.461200Z

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

dominicm 2020-06-25T11:33:09.461700Z

I'm pretty sure it doesn't

dominicm 2020-06-25T11:33:11.461900Z

By design

dominicm 2020-06-25T11:37:53.463Z

It just gets the highest version in the range

murtaza52 2020-06-25T14:05:20.466500Z

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 ?

seancorfield 2020-06-25T15:34:12.467900Z

@murtaza52 Did you also get this WARNINg about that error message?

WARNING: Specified aliases are undeclared: [:new]
What does clojure -Sdescribe show for you?

murtaza52 2020-06-25T15:36:44.468200Z

~ >>> 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 ""}

murtaza52 2020-06-25T15:37:14.468700Z

@seancorfield No I did not get that warning

murtaza52 2020-06-25T15:39:55.469900Z

I moved the file /.clojure/deps.edn to /.config/clojure/deps.edn, but I am still getting the same output as above.

seancorfield 2020-06-25T15:46:46.471Z

How did you install the Clojure CLI tools? I've never seen it try to use ~/.config/clojure as the user-level location...

seancorfield 2020-06-25T15:47:38.471600Z

What O/S is this on? What is your HOME environment variable? (`echo $HOME`)

murtaza52 2020-06-25T15:48:08.471800Z

~ >>> echo $HOME /home/murtaza52

borkdude 2020-06-25T15:48:17.472200Z

this is caused by xdg-config stuff on linux right

murtaza52 2020-06-25T15:48:23.472400Z

This is manjaro linux

murtaza52 2020-06-25T15:51:00.475300Z

sorry I m still lost, how should I fix it ? where does that deps.clj go ?

seancorfield 2020-06-25T15:51:21.476100Z

It's a separate tool. He's just showing that the XDG thing is a problem.

murtaza52 2020-06-25T15:51:49.476700Z

this is a new install of manjaro without a DE, I had installed it before with DE and it worked fine.

borkdude 2020-06-25T15:51:54.477Z

yeah, I should point to the bash script, this is a clojure port of it

borkdude 2020-06-25T15:52:06.477400Z

can you do echo $XDG_CONFIG_HOME?

murtaza52 2020-06-25T15:52:11.477500Z

this one just bspwm as the tiling manager

murtaza52 2020-06-25T15:52:52.478Z

~ >>> echo $XDG_CONFIG_HOME /home/murtaza52/.config

borkdude 2020-06-25T15:52:54.478100Z

and then try with the -Sforce with your changes in place

borkdude 2020-06-25T15:53:09.478500Z

yes, so it will look for /home/.../.config/clojure/deps.edn

murtaza52 2020-06-25T15:54:15.479600Z

but in already has a dir called /.config/clojure , should I replace it with /.config/.clojure ?

borkdude 2020-06-25T15:55:14.480100Z

no sorry, without the dot, it was a typo on my behalf

borkdude 2020-06-25T15:55:45.480600Z

and then re-try your action with -Sforce

murtaza52 2020-06-25T15:56:07.481100Z

what does sforce do ? yes it worked !

1
borkdude 2020-06-25T15:56:18.481400Z

it ignores a cached file

murtaza52 2020-06-25T15:56:55.481800Z

cool thanks !

seancorfield 2020-06-25T15:58:15.482800Z

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...?

seancorfield 2020-06-25T16:01:39.485700Z

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.

souenzzo 2020-06-25T17:23:16.487600Z

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)

souenzzo 2020-06-25T17:23:26.487700Z

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

2020-06-25T17:32:59.488Z

jgit may not support whatever authentication method git is using there

ghadi 2020-06-25T17:44:16.488200Z

you need to use ssh auth, not https

souenzzo 2020-06-25T18:17:09.488400Z

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?

ghadi 2020-06-25T18:17:44.488700Z

yes

ghadi 2020-06-25T18:17:50.488900Z

and put the key in an ssh-agent

murtaza52 2020-06-25T19:26:45.490Z

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 ?

seancorfield 2020-06-25T19:28:53.490400Z

No. The template is only used when the project is first created.

seancorfield 2020-06-25T19:29:17.490800Z

After that, it's just "your project" and no longer related to the template.

murtaza52 2020-06-25T19:53:16.491900Z

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 ?

seancorfield 2020-06-25T19:54:56.492600Z

By default, clj-new always uses the most recent stable version of a template.

seancorfield 2020-06-25T19:55:56.493100Z

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

murtaza52 2020-06-25T19:58:21.494Z

cool thanks

souenzzo 2020-06-25T20:19:26.494100Z

@ghadi that't not aplicable once I'm trying to use LaunchConfig

2020-06-25T22:00:16.497Z

@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

seancorfield 2020-06-25T22:05:23.498Z

@danvingo It will use whatever version t.d.a. would select if it were a dependency with a "RELEASE" version.

seancorfield 2020-06-25T22:05:35.498300Z

What is the template you're trying to work with?

2020-06-25T22:06:48.499500Z

I wanted to use dates as the versions... I'm just learning about the wonderful world of maven version semantics

seancorfield 2020-06-25T22:07:48.499900Z

I posted the options above that would let you do that.

seancorfield 2020-06-25T22:08:56.000700Z

When I tried it -- having never looked at that template before -- here's what I got:

(! 709)-&gt; 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.

2020-06-25T22:10:11.001Z

ah thank you! sorry I overlooked that

seancorfield 2020-06-25T22:10:59.001400Z

And here's how to pull down specific versions:

(! 714)-&gt; 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)-&gt; 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)-&gt; 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)-&gt; 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)-&gt; 

2020-06-25T22:13:10.002500Z

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.

seancorfield 2020-06-25T22:14:19.003200Z

Well, you won't see any output if it doesn't have to download anything.

2020-06-25T22:15:02.003600Z

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

seancorfield 2020-06-25T22:16:15.003900Z

I think t.d.a. only checks once per day for releases.

2020-06-25T22:16:36.004300Z

ahhh, ok

seancorfield 2020-06-25T22:17:12.005Z

It's very unusual to have multiple releases on the same day. Even with snapshots.

seancorfield 2020-06-25T22:18:07.006200Z

If you blow away ~/.m2/repository/dv/fulcro-template/clj-template then it should download whatever is the latest version.

2020-06-25T22:18:10.006300Z

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

seancorfield 2020-06-25T22:18:21.006500Z

Yup, that 🙂

seancorfield 2020-06-25T22:19:02.007100Z

Like I said above, you can always use the -V / --version option to download a specific version.

2020-06-25T22:19:30.007600Z

right -thanks again!

seancorfield 2020-06-25T22:22:12.008500Z

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.

seancorfield 2020-06-25T22:24:39.009600Z

(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

seancorfield 2020-06-25T22:25:13.010300Z

So it may be that the range checks every time? (maybe a Maven expert can confirm/deny that?)

2020-06-25T22:26:36.012Z

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 🙂

seancorfield 2020-06-25T22:26:51.012200Z

(hard to tell -- having pulled down the -2 version, running it without a version still pulled down -4 for me, based on RELEASE instead)

seancorfield 2020-06-25T22:27:20.012600Z

If you're not doing more than one release a day, I suspect you won't have a problem 🙂

2020-06-25T22:28:30.012800Z

perfect, thanks!

seancorfield 2020-06-25T22:36:11.014300Z

One final thing @danvingo if you use the -S option, it uses a version range of (0.0.0,)

2020-06-25T22:38:59.015900Z

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

seancorfield 2020-06-25T22:40:45.016600Z

This is partly why I've moved to MAJOR.MINOR.COMMITS so I don't have to worry about that. COMMITS is always increasing.

2020-06-25T22:43:19.017800Z

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)

seancorfield 2020-06-25T22:48:31.020100Z

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!)