HelloWorld示例(sbt new sbt / scala-seed.g8)无效

时间:2017-01-04 14:00:44

标签: scala sbt

在使用scala 2.12.0在Mac 10.12.2上安装sbt版本0.13.13(使用brew)后,我尝试了文档中的第一个示例(根据主题sbt new sbt/scala-seed.g8)。

结果是:

...
[info] Set current project to hello (in build file:/scratch/hello/)
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
org.eclipse.jgit.api.errors.TransportException: http://github.com/sbt/scala-seed.g8.git: 301 Moved Permanently
at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:139)
...

我是个新人,只是想知道这是不是因为我的经验不足...

5 个答案:

答案 0 :(得分:11)

运行它作为参数传递给git url:

sbt new https://github.com/sbt/scala-seed.g8

无需更改任何git配置。

答案 1 :(得分:1)

尝试使用

sbt new scala/scala-seed.g8

需要git中的预定义模板,但是当您使用git中的一个示例模板时,它将创建一个具有最小scala构建的sbt项目。 并且为了命名项目,预定义的模板通常为您提供了这样做的选项。

答案 2 :(得分:1)

git clone http://github.com/scala/hello-world.g8.git

mv ./hello-world.g8/src/main/g8 hello-world

cd hello-world

sbt运行

(假设您已经安装了git)

答案 3 :(得分:1)

我想分享一下我的经验:

我想运行#wrongAnwer { color: red; } 并遇到错误

“ git@github.com:scalatra / scalatra.g8.git:无效的私钥:[....”

如何解决?

sbt new scalatra/scalatra.g8

现在可以正常工作并打印

mkdir temp 
cd temp
git clone https://github.com/foundweekends/giter8.g8
g8 file://giter8.g8

希望它将节省某人的时间。

答案 4 :(得分:0)

我遇到了类似的问题。我解决的方法是 通过安装sdkman

curl -s "https://get.sdkman.io" | bash 

然后,我使用sdkman而不是系统软件包管理器来安装scala内容:

sdk install java
sdk install sbt
sdk install scala

之后,documentation中的示例在我的机器上运行正常。

相关问题