SBT 在创建项目时要求提供凭据

标签 sbt

我对 Scala 和 SBT 完全陌生。我有 downloaded .tgz SBT 1.3.2 存档,解压并添加 bin目录到我的 PATH在 Ubuntu 18.04 上。

我正在关注 official Getting Started guide ,它给出了创建一个简单项目的命令。它应该像这样运行:

$ sbt new sbt/scala-seed.g8
....
Minimum Scala build.

name [My Something Project]: hello

Template applied in ./hello

相反,它要求我提供凭据:
$ sbt new sbt/scala_seed.g8
[info] Set current project to code (in build file:/home/user/code/)
[info] Set current project to code (in build file:/home/user/code/)
Username:

我不知道该输入什么。我什至无法猜测,因为在它要求输入密码之前我只能输入一个字符。如果我再次输入一个字符,我会再次收到用户名提示。这是按下两个键后的输出:
$ sbt new sbt/scala_seed.g8
[info] Set current project to code (in build file:/home/user/code/)
[info] Set current project to code (in build file:/home/user/code/)
Username: Password:
Username:

我只想设置一个基本项目。我究竟做错了什么?

最佳答案

当我尝试按照 https://docs.scala-lang.org/getting-started/sbt-track/getting-started-with-scala-and-sbt-on-the-command-line.html 的说明创建新项目时,也遇到了同样的错误。使用 sbt cli。
我运行了如下命令,

sbt new hw/hello-world.g8
按照上面的命令,我被提示输入用户名和密码。然后我再次运行它
sbt new scala/hello-world.g8
这次项目创建成功。
输出:
hello-world.g8
[info] welcome to sbt 1.3.13 (Oracle Corporation Java 1.8.0_261)
[info] set current project to scala (in build file:/C:/scala/)
[info] set current project to scala (in build file:/C:/scala/)

A template to demonstrate a minimal Scala application

name [Hello World template]: hello-world

Template applied in C:\scala\.\hello-world
所以硬件 在命令“sbt new hw /hello-world.g8”中是不正确的,它只能是“sbt new scala /hello-world.g8”。

关于SBT 在创建项目时要求提供凭据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58057826/

相关文章:

scala - 尝试使用 Scalatra 编译项目但失败

scala - 在 Scala 项目上 Play 依赖项

scala - sbt assemblyMergeStrategy 不工作

scala - 使用 Scala 的 Maven 或 SBT?

scala - 如何修复 Scala 应用程序中的 "static methods in interface require -target:jvm-1.8"?

scala - 如何在多项目 .sbt 构建中定义构建范围的设置?

sbt - 如何在 sbt 设置初始化期间打印到流

java - Spark 找不到 Scala 特定方法

mysql - Scala/Slick, "Timeout after 20000ms of waiting for a connection"错误

scala - 为什么 crossScalaVersion 不是 scalaVersion?