首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在Mac OS X 10.7.2上运行Leiningen

在Mac OS X 10.7.2上运行Leiningen
EN

Stack Overflow用户
提问于 2012-01-17 16:07:32
回答 1查看 1.5K关注 0票数 0

我通过MacPorts在MacOSX10.7.2上安装了Leiningen:

代码语言:javascript
复制
$ lein version
Leiningen 1.6.1.1 on Java 1.6.0_29 Java HotSpot(TM) 64-Bit Server VM

我还安装了clojureclojure-contrib包:

代码语言:javascript
复制
$ sudo port installed clojure*
The following ports are currently installed:
  clojure @1.3.0_0 (active)
  clojure-contrib @1.2.0_0 (active)

为了测试我的环境,我生成了一个样例helloworld项目as described here by Zef Hemel。下面是project.clj文件:

代码语言:javascript
复制
(defproject helloworld "0.1"
    :dependencies [[org.clojure/clojure
                      "1.3.0-master-SNAPSHOT"]
                   [org.clojure/clojure-contrib
                      "1.2.0-SNAPSHOT"]]
    :main helloworld)

下面是helloworld.clj文件:

代码语言:javascript
复制
(ns helloworld
  (:gen-class))

(defn -main [& args]
  (println "Hello world!"))

当我尝试编译这个项目时,我收到了几条更新消息...

代码语言:javascript
复制
$ pwd
/Users/alexreynolds/helloworld

$ sudo lein compile
[INFO] snapshot org.clojure:clojure:1.3.0-master-SNAPSHOT: checking for updates from clojars
Downloading: org/clojure/clojure/1.3.0-master-SNAPSHOT/clojure-1.3.0-master-SNAPSHOT.pom from clojars
[INFO] snapshot org.clojure:clojure-contrib:1.2.0-SNAPSHOT: checking for updates from clojars
Downloading: org/clojure/clojure-contrib/1.2.0-SNAPSHOT/clojure-contrib-1.2.0-SNAPSHOT.pom from clojars
Downloading: org/clojure/clojure/1.3.0-master-SNAPSHOT/clojure-1.3.0-master-SNAPSHOT.jar from clojars
Downloading: org/clojure/clojure-contrib/1.2.0-SNAPSHOT/clojure-contrib-1.2.0-SNAPSHOT.jar from clojars

然后...and一大堆错误:

代码语言:javascript
复制
An error has occurred while processing the Maven artifact tasks.
 Diagnosis:

Unable to resolve artifact: Missing:
----------
1) org.clojure:clojure:jar:1.3.0-master-SNAPSHOT

  Try downloading the file manually from the project website.

  Then, install it using the command:
      mvn install:install-file -DgroupId=org.clojure -DartifactId=clojure -Dversion=1.3.0-master-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file

  Alternatively, if you host your own repository you can deploy the file there:
      mvn deploy:deploy-file -DgroupId=org.clojure -DartifactId=clojure -Dversion=1.3.0-master-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

  Path to dependency:
        1) org.apache.maven:super-pom:jar:2.0
        2) org.clojure:clojure:jar:1.3.0-master-SNAPSHOT

2) org.clojure:clojure-contrib:jar:1.2.0-SNAPSHOT

  Try downloading the file manually from the project website.

  Then, install it using the command:
      mvn install:install-file -DgroupId=org.clojure -DartifactId=clojure-contrib -Dversion=1.2.0-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file

  Alternatively, if you host your own repository you can deploy the file there:
      mvn deploy:deploy-file -DgroupId=org.clojure -DartifactId=clojure-contrib -Dversion=1.2.0-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

  Path to dependency:
        1) org.apache.maven:super-pom:jar:2.0
        2) org.clojure:clojure-contrib:jar:1.2.0-SNAPSHOT

----------
2 required artifacts are missing.

for artifact:
  org.apache.maven:super-pom:jar:2.0

from the specified remote repositories:
  clojars (http://clojars.org/repo/),
  central (http://repo1.maven.org/maven2)

----------
2 required artifacts are missing.

for artifact:
  org.apache.maven:super-pom:jar:2.0

from the specified remote repositories:
  clojars (http://clojars.org/repo/),
  central (http://repo1.maven.org/maven2)

 (NO_SOURCE_FILE:0)
        at clojure.lang.Compiler.eval(Compiler.java:5440)
        at clojure.lang.Compiler.eval(Compiler.java:5391)
        at clojure.core$eval.invoke(core.clj:2382)
        at clojure.main$eval_opt.invoke(main.clj:235)
        at clojure.main$initialize.invoke(main.clj:254)
        at clojure.main$script_opt.invoke(main.clj:270)
        at clojure.main$main.doInvoke(main.clj:354)
        at clojure.lang.RestFn.invoke(RestFn.java:457)
        at clojure.lang.Var.invoke(Var.java:377)
        at clojure.lang.AFn.applyToHelper(AFn.java:172)
        at clojure.lang.Var.applyTo(Var.java:482)
        at clojure.main.main(main.java:37)
Caused by: Unable to resolve artifact: Missing:
----------
1) org.clojure:clojure:jar:1.3.0-master-SNAPSHOT

  Try downloading the file manually from the project website.

  Then, install it using the command:
      mvn install:install-file -DgroupId=org.clojure -DartifactId=clojure -Dversion=1.3.0-master-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file

  Alternatively, if you host your own repository you can deploy the file there:
      mvn deploy:deploy-file -DgroupId=org.clojure -DartifactId=clojure -Dversion=1.3.0-master-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

  Path to dependency:
        1) org.apache.maven:super-pom:jar:2.0
        2) org.clojure:clojure:jar:1.3.0-master-SNAPSHOT

2) org.clojure:clojure-contrib:jar:1.2.0-SNAPSHOT

  Try downloading the file manually from the project website.

...

----------
2 required artifacts are missing.

for artifact:
  org.apache.maven:super-pom:jar:2.0

from the specified remote repositories:
  clojars (http://clojars.org/repo/),
  central (http://repo1.maven.org/maven2)


    at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolveTransitively(DefaultArtifactResolver.java:324)
        at org.apache.maven.artifact.ant.DependenciesTask.doExecute(DependenciesTask.java:170)
    ... 38 more

我已经尝试过self-install

代码语言:javascript
复制
$ sudo lein self-install
Downloading Leiningen now...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 9161k  100 9161k    0     0  1889k      0  0:00:04  0:00:04 --:--:-- 2580k

但是在第二次尝试compile时,我得到了相同的警告和错误。

为了修复这个问题,我应该尝试什么?谢谢你的建议。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-01-17 16:29:33

SNAPSHOT版本通常部署到单独的maven存储库。Leiningen的最新版本不在默认的存储库列表中包含Clojure快照存储库。

除非您有充分的理由使用SNAPSHOT依赖项,否则应该在project.clj中列出稳定的版本:

代码语言:javascript
复制
(defproject helloworld "0.1"
    :dependencies [[org.clojure/clojure "1.3.0"]]
    :main helloworld)

(我删除了clojure-contrib,因为1.2.0版本与clojure 1.3不兼容,而且您的示例项目也没有使用它。)

票数 5
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/8891412

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档