Help with deploying app to clojar

Hi. Please help me publish my test app on clojar.
I created a test app with this cmd lein new app my-app

I modified the project.clj file with this …

   1   │ (defproject my-app "0.1.0-SNAPSHOT"
   2   │   :description "testing deploy"
   3   │   :url "https://clojars.org/groups/org.clojars.kyp0717"
   4   │   :license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"
   5   │             :url "https://www.eclipse.org/legal/epl-2.0/"}
   6   │   :dependencies [[org.clojure/clojure "1.10.1"]]
   7   │   :main my-app.core
   8   │   :target-path "target/%s"
   9   │   :profiles {:uberjar {:aot :all
  10   │                        :jvm-opts ["-Dclojure.compiler.direct-linking=true"]}})

Finally, I published with this cmd lein deploy clojars
My version of lein is Leiningen 2.9.5 on Java 11.0.10 OpenJDK 64-Bit Server VM
What am I doing wrong?

Here is the error …

➜  my-app lein deploy clojars
No credentials found for clojars
See `lein help deploying` for how to configure credentials to avoid prompts.
Username: kyp0717
Password: 
Compiling my-app.core
Created /home/phage/tmp/my-app/target/my-app-0.1.0-SNAPSHOT.jar
Wrote /home/phage/tmp/my-app/pom.xml
Could not find metadata my-app:my-app:0.1.0-SNAPSHOT/maven-metadata.xml in clojars (https://repo.clojars.org/)
Sending my-app/my-app/0.1.0-SNAPSHOT/my-app-0.1.0-20210404.155005-1.jar (14k)
    to https://repo.clojars.org/
Could not transfer artifact my-app:my-app:jar:0.1.0-20210404.155005-1 from/to clojars (https://repo.clojars.org/): Failed to transfer file https://repo.clojars.org/my-app/my-app/0.1.0-SNAPSHOT/my-app-0.1.0-20210404.155005-1.jar with status code 401
Sending my-app/my-app/0.1.0-SNAPSHOT/my-app-0.1.0-20210404.155005-1.pom (2k)
    to https://repo.clojars.org/
Could not transfer artifact my-app:my-app:pom:0.1.0-20210404.155005-1 from/to clojars (https://repo.clojars.org/): Failed to transfer file https://repo.clojars.org/my-app/my-app/0.1.0-SNAPSHOT/my-app-0.1.0-20210404.155005-1.pom with status code 401
Failed to deploy artifacts: Could not transfer artifact my-app:my-app:jar:0.1.0-20210404.155005-1 from/to clojars (https://repo.clojars.org/): Failed to transfer file https://repo.clojars.org/my-app/my-app/0.1.0-SNAPSHOT/my-app-0.1.0-20210404.155005-1.jar with status code 401

You seem to be trying to publish under the generic my-app name which is restricted nowadays. From the URL it appears that you meant to publish under the org.clojars.kyp0717 group which means you need to switch your defproject to that name.

(defproject org.clojars.kyp0717/my-app "0.1.0-SNAPSHOT ...)

The :url is just extra metadata and does not control anything with regards to publishing.

1 Like

401 means you probably don’t have permission to that package,

did you setup clojars permissions correctly, clojars deploy token or GPG key?

or are you sure you are publishing to the package name under your own scope(rather than someone else’s)?

1 Like

Thanks @thheller and @jiyinyiyong !!!
I made 2 mistakes and you both found them! I fixed the project.clj file with the correct group as @thheller suggested and I added GPG key as @jiyinyiyong suggested.
It worked! Thanks.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.