How can I deploy a Leiningen template to Clojars?

大兔子大兔子 提交于 2019-12-22 08:07:41

问题


I have created a Leiningen project on my local machine which I then turn into a template by doing:

lein create-template webdb

: Then I install the template:

cd webdb
lein install

: which allows me to create projects based on the template locally:

lein new webdb anewproject

: Everything works fine up to here. However if I try to deploy the template to clojars using:

cd webdb
lein deploy clojars

: then whenever I try to use the clojars profile to create a template I get an error:

lein new org.clojars.zubairq2/webdb anothernewproject

: gives the error:

Could not find metadata org.clojars.zubairq2/webdb:lein-template/maven-metadata.xml in local (/Users/faroukzquraishi/.m2/repository)
Failure to find org.clojars.zubairq2/webdb:lein-template/maven-metadata.xml in http://repo1.maven.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced
Failure to find org.clojars.zubairq2/webdb:lein-template/maven-metadata.xml in http://clojars.org/repo/ was cached in the local repository, resolution will not be reattempted until the update interval of clojars has elapsed or updates are forced
This could be due to a typo in :dependencies or network issues.
Could not find template org.clojars.zubairq2/webdb on the classpath.

: does anyone know what I am doing wrong here?

Update - project.clj

(defproject cljstemplate "org.clojars.zubairq2/webdb"
  :dependencies [
                   [org.clojure/clojure "1.5.1"]
                   [org.clojure/google-closure-library-third-party "0.0-2029"]
                   [domina "1.0.1"]
                   [crate "0.2.4"]
                   [prismatic/dommy "0.1.1"]
                   [korma "0.3.0-RC5"]
                   [org.postgresql/postgresql "9.2-1002-jdbc4"]
                   [compojure "1.1.5"]
                   [shoreleave "0.3.0"]
                   [shoreleave/shoreleave-remote-ring "0.3.0"]
                   [ring-middleware-format "0.3.0"]
                   [ring/ring-json "0.2.0"]
                   [jayq "2.3.0"]
                ]

  :url "http://org.clojars.zubair2/webdb"

  :plugins  [
               [lein-cljsbuild "0.3.0"]
               [lein-httpd "1.0.0"]
               [lein-ring "0.8.5"]
            ]

  :source-paths ["src"]

  :ring {:handler webapp.framework.server.core/app}

  :cljsbuild
  {
    :builds
     [
      {
         :source-paths ["src"]
         :compiler     {
                         :output-to      "resources/public/main.js"
                         :optimizations  :simple
                         :externs        ["resources/public/jquery.js" "resources/public/google_maps_api_v3_3.js"]
                         :pretty-print   false
                       }
      }
     ]

  }
)

回答1:


your upload seems to have worked and the result is here:

https://clojars.org/webdb/lein-template

you can make a project like this:

arthur@a:~$ lein new webdb newproject
Retrieving webdb/lein-template/0.1.0-SNAPSHOT/lein-template-0.1.0-20130618.143034-5.pom from clojars
Retrieving webdb/lein-template/0.1.0-SNAPSHOT/lein-template-0.1.0-20130618.143034-5.jar from clojars



回答2:


To use a lein plugin, you must make it a dependency it in your .lein/profiles.clj

Since you project is on clojars, if you add its dependency it should be available to you.



来源:https://stackoverflow.com/questions/17171739/how-can-i-deploy-a-leiningen-template-to-clojars

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!