gpt4 book ai didi

scala - 如何设置 IntelliJ + Scala + specs + sbt 项目?

转载 作者:行者123 更新时间:2023-12-03 03:59:15 25 4
gpt4 key购买 nike

我正在尝试使用 Specs2 for Scala (2.10) 设置一个空的 sbt 项目,并支持 IntelliJ (12.1),当我在空项目目录上执行 sbtcompile 时,我收到此错误:

% sbt compile                                                                                                                                                                                                 
Getting net.java.dev.jna jna 3.2.3 ...
:: retrieving :: org.scala-sbt#boot-jna
confs: [default]
1 artifacts copied, 0 already retrieved (838kB/32ms)
Getting org.scala-sbt sbt_2.9.1 0.11.3 ...
:: retrieving :: org.scala-sbt#boot-app
confs: [default]
37 artifacts copied, 0 already retrieved (7245kB/734ms)
Getting Scala 2.9.1 (for sbt)...
:: retrieving :: org.scala-sbt#boot-scala
confs: [default]
4 artifacts copied, 0 already retrieved (19939kB/402ms)
[info] Loading project definition from /Users/pathikrit/Projects/scalgos/project
[info] Set current project to scalgos (in build file:/Users/pathikrit/Projects/scalgos/)
Getting Scala 2.10.1 ...
:: retrieving :: org.scala-sbt#boot-scala
confs: [default]
5 artifacts copied, 0 already retrieved (24386kB/107ms)
[info] Updating {file:/Users/pathikrit/Projects/scalgos/}default-7d65e1...
[info] Resolving org.scala-lang#scala-library;2.10.1 ...
[info] Resolving org.specs2#specs2_2.10.1;1.14 ...
[warn] module not found: org.specs2#specs2_2.10.1;1.14
[warn] ==== local: tried
[warn] /Users/pathikrit/.ivy2/local/org.specs2/specs2_2.10.1/1.14/ivys/ivy.xml
[warn] ==== public: tried
[warn] http://repo1.maven.org/maven2/org/specs2/specs2_2.10.1/1.14/specs2_2.10.1-1.14.pom
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: org.specs2#specs2_2.10.1;1.14: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[error] {file:/Users/pathikrit/Projects/scalgos/}default-7d65e1/*:update: sbt.ResolveException: unresolved dependency: org.specs2#specs2_2.10.1;1.14: not found
[error] Total time: 4 s, completed Mar 25, 2013 5:11:17 PM

我的 build.sbt 文件如下所示:

name := "scalgos"

version := "0.0.1"

scalaVersion := "2.10.1"

libraryDependencies += "org.specs2" %% "specs2" % "1.14" % "test"

我通过执行 brew install sbt 安装了 sbt:

% brew info sbt                                                                                                                                                                                   
sbt: stable 0.12.2, devel 0.13.0-M1
http://www.scala-sbt.org
/usr/local/Cellar/sbt/0.11.3-2 (3 files, 1.1M) *
https://github.com/mxcl/homebrew/commits/master/Library/Formula/sbt.rb
==> Caveats
You can use $SBT_OPTS to pass additional JVM options to SBT.
For convenience, this can specified in `~/.sbtconfig`.

For example:
SBT_OPTS="-XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256M"

Brew 说我有 sbt 0.12,但是当我 sbt --version 时,我得到:

% sbt --version                                                                                                                                                                                    
sbt launcher version 0.11.3-2

我尝试至少通过将其放入我的 $PROJECT_DIR/projects/plugins.sbt 中来生成 IntelliJ 文件:

resolvers += "sbt-idea-repo" at "http://mpeltonen.github.com/maven/"

addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.2.0")

但是当我执行sbt gen-idea时,我得到了这个错误:

% sbt gen-idea                                                                                                                                                                                               
[info] Loading project definition from /Users/pathikrit/Projects/scalgos/project
[info] Set current project to scalgos (in build file:/Users/pathikrit/Projects/scalgos/)
[info] Trying to create an Idea module scalgos
[info] Updating {file:/Users/pathikrit/Projects/scalgos/}default-7d65e1...
[info] Resolving org.scala-lang#scala-library;2.10.1 ...
[info] Resolving org.specs2#specs2_2.10.1;1.14 ...
[warn] module not found: org.specs2#specs2_2.10.1;1.14
[warn] ==== local: tried
[warn] /Users/pathikrit/.ivy2/local/org.specs2/specs2_2.10.1/1.14/ivys/ivy.xml
[warn] ==== public: tried
[warn] http://repo1.maven.org/maven2/org/specs2/specs2_2.10.1/1.14/specs2_2.10.1-1.14.pom
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: org.specs2#specs2_2.10.1;1.14: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[error] {file:/Users/pathikrit/Projects/scalgos/}default-7d65e1/*:update: sbt.ResolveException: unresolved dependency: org.specs2#specs2_2.10.1;1.14: not found
[info] Updating {file:/Users/pathikrit/Projects/scalgos/}default-7d65e1...
[info] Resolving org.scala-lang#scala-library;2.10.1 ...
[info] Resolving org.specs2#specs2_2.10.1;1.14 ...
[warn] module not found: org.specs2#specs2_2.10.1;1.14
[warn] ==== local: tried
[warn] /Users/pathikrit/.ivy2/local/org.specs2/specs2_2.10.1/1.14/ivys/ivy.xml
[warn] ==== public: tried
[warn] http://repo1.maven.org/maven2/org/specs2/specs2_2.10.1/1.14/specs2_2.10.1-1.14.pom
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: org.specs2#specs2_2.10.1;1.14: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[error] {file:/Users/pathikrit/Projects/scalgos/}default-7d65e1/*:update: sbt.ResolveException: unresolved dependency: org.specs2#specs2_2.10.1;1.14: not found
[error] Failed to obtain dependency classpath
[error] java.lang.IllegalArgumentException
[error] Use 'last' for the full log.

有人可以发布一个示例 build.sbt 来为 Scala 2.10.1 和 sbt 生成 IntelliJ 12.1 文件吗?

我在这里 checkin 了我的项目:https://github.com/pathikrit/scalgos

请告诉我我做错了什么???

最佳答案

您可以使用我构建的这个项目,它提供您正在寻找的开箱即用的内容

Skeleton

我计划今晚升级 sbt 配置和最新最好的库(sbt-idea 1.3.0 和 scala 2.10.1)。

享受吧!

关于scala - 如何设置 IntelliJ + Scala + specs + sbt 项目?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15625191/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com