clojars 2026-02-18

Hi, can anyone tell me why won't the Git/SCM repo link appear on (top left of) this Clojars page? https://clojars.org/io.github.plumce/plumcp.core My project.clj already has :url entry pointing to Github repo.

Do I need to add :scm entry in my project.clj?

Yes, you need SCM information. It's why cljdoc isn't building as well https://cljdoc.org/builds/99347

(that should also solve the Clojars git link issue)

Thank you, @seancorfield 🙏🏽

The cljdoc URL above mentions bidi, but I don't find any SCM info in bidi's project.clj: https://github.com/juxt/bidi - is the SCM info to be added to pom.xml after it is generated from project.clj?

Oops, Sean already posted, sorry Sean, not enough coffee yet!

I can see one can put :scm in project.clj, but I would like to avoid hard coding the tag: https://gitlab.com/technomancy/leiningen/blob/master/sample.project.clj#L492-498

I would have expected lein to build that for you based on project.clj -- how are you building your JAR for Clojars?

lein jar builds the JAR, and it's called transitively when I lein deploy clojars

Sorry, it's been years since I used Leiningen... If you add :scm stuff without the tag, does it populate that in pom.xml (in the JAR)?

Ah, just below what I linked to:

:scm {:name "git" :url ""}

So it only needs :name and :url and Leiningen will do the rest.

I'm lein rusty too. I just did a lein jar on bidi, and it does populate scm in pom.xml

Maybe the :url is enough in project.clj.

I added :scm {:name "git" :url "..."} and ran lein pom - I got this in the generated pom.xml:

<scm>
    <url></url>
  </scm>

It doesn't auto-add any other entry.

Is your project git initialized? I think lein will git add the sha to scm entry.

@lee My project.clj has :url specified, but lein skips the <scm> entry.

Yes, my repo is on Github already (and locally too, of course)

I am on lein 2.12.0 btw

Hmm... to me lein does some things a bit magically. And I don't remember the magic. Bidi seems to generate the pom scm appropriately. I wonder what is different.

I added :name, :url, :connection and :developerConnection under :scm in project.clj - those all end up in pom.xml as expected.

I think pom scm gets filled magically from top level project.clj :url and your git remote?

I ran lein new clojars/example to get a default library project, and lein jar produces a pom.xml with <scm /> in it -- when I added that :scm fragment above and regenerated the JAR, I got <scm> containing <url> but no tag/version info. Then I git init'd the repo, git add . and git commit -m "init" and now when I run lein jar, I get <tag> in the <scm> section in pom.xml.

So you only get <tag> if you're in a git repo with at least one committed change (which is expected I guess).

Yep, just tested too. Before adding a remote did not fully populate pom scm. Here's my project.clj

(defproject foobar "1.2.3"
  :description "foo"
  :url ""

  :license {:name "The MIT License"
            :url ""})
Here's the resulting pom.xml scm section after lein jar:
<scm>
    <url></url>
    <connection>scm:git:</connection>
    <developerConnection>scm:git:</developerConnection>
    <tag>e8d0fb5c431f80336f7f482611ab49ec85ff64a8</tag>
  </scm>

I am guessing there's something messing up the scm generation in this particular project - in my other projects <scm> has been generated fine automatically. I need to troubleshoot.

For my little test project:

$ git remote -v 
origin	git@github.com:lread/lein-scm.git (fetch)
origin	git@github.com:lread/lein-scm.git (push)

I got a similar ^ response for git remote -v

And you've pushed your commits, I assume.

Yes! Pushed everything.

I'll take a peek at your GitHub project... see what I can see.

@lee Sure, the module path in my repo is here: https://github.com/plumce/plumcp/tree/main/module-core - Just copy project-release.clj as project.clj locally and edit the file to have a proper version. Then run the lein commands.

Ah, I wonder if it's because it's a module in a repo, and not the top-level of the repo?

Even Ring is multi-module: https://github.com/ring-clojure/ring but it has proper SCM generated, which shows up on Clojars.

Ah, all of the Ring modules have this entry in project.clj: :scm {:dir ".."}

Maybe that's trick!

Yes, but it has a root project.clj and sub projects

Oh you probably found it, there!

Probably I need to create a similar setup like Ring (top level project.clj) to auto-resolve SCM. I will experiment and find out.

If I add {:dir ".."} to your core project.clj, it works:

<scm>
    <url></url>
    <connection>scm:git:</connection>
    <developerConnection>scm:git:</developerConnection>
    <tag>955224a9e15c29371be9cf66093e0cba9033cbac</tag>
  </scm>

Yes, just adding that bit is enough - I saw that too. Thank you!

Thank you everyone for sharing pointers, ideas and debugging! 🙏🏽

I'll add a couple of tips to the cljdoc library author docs on how lein works (if only to help future me remember!).

💙 1

I think I was wrong above, I don't think lein will use the top level :url for the pom scm info.

I could have done better with patient reading of the sample project.clj - yes, the ^ comment explains it well.

Hey, I was as confused as you (maybe even more so!).

I'm now remembering that the sample project.clj is the main way leiningen delivers its docs...

➕ 1

Oh son of a gun, I had already documented this under https://github.com/cljdoc/cljdoc/blob/master/doc/userguide/for-library-authors.adoc#git-sources Here are some common ways folks set <scm> values: • ... • https://leiningen.org/ will automatically create the <scm> entry for you if you set the :scmhttps://github.com/technomancy/leiningen/blob/bd3ecfcfb20ef7a79912879ff892e0f2317e8691/sample.project.clj#L490`project.clj`. For example: :scm {:name "git" :url "https://github.com/your-github-org/your-project"} So much for RTFMing my own M!

😅 1

That's where I linked to above and quoted that fragment 😄

❤️ 1

And I linked to it too! I'm not doing my last name justice at all! simple_smile

I went ahead and added more detail to cljdoc library authors guide: https://github.com/cljdoc/cljdoc/pull/1164.

🙌 1
🙌🏽 1