jbang icon indicating copy to clipboard operation
jbang copied to clipboard

Incorrect locator generated for `//DEPS` links to GitHub repos

Open holly-cummins opened this issue 1 year ago • 0 comments

https://www.jbang.dev/documentation/guide/latest/dependencies.html#using-links-to-git-sources

says that https://github.com/jbangdev/jbang is converted to the locator com.github.jbangdev:jbang:HEAD-SNAPSHOT. I'm seeing it being converted to a jbang:-SNAPSHOT locator, which can't resolve.

I wondered about just dropping the line in the docs, but it's possibly almost as easy to correct the locator generation to do what the docs say.

For example,

//DEPS https://github.com/holly-cummins/github-api/

gives

Run jbangdev/[email protected]
...
[jbang] Resolving dependencies...
[jbang]    com.github.holly-cummins:github-api:-SNAPSHOT
[jbang]    info.picocli:picocli:4.2.0
Error:  [ERROR] Could not resolve dependencies: Could not find artifact com.github.holly-cummins:github-api:jar:-SNAPSHOT 
...

I see the same thing locally with jbang 0.92.2

Tree references with an explicit commit, like //DEPS https://github.com/holly-cummins/github-api/tree/gg287262 do generate a correct locator. If I add a tree reference to head, it works, as long as SNAPSHOT is mentioned explicitly:

//DEPS https://github.com/holly-cummins/github-api/tree/main#:SNAPSHOT

Without the SNAPSHOT, it doesn't work:

//DEPS https://github.com/holly-cummins/github-api/tree/main

gives a locator of com.github.holly-cummins:github-api:jar:main, which isn't valid. (That's maybe ok, because the docs don't say it should work, I was just trying it as a workaround.)

holly-cummins avatar Jul 04 '24 15:07 holly-cummins