我有一个scala项目,我用sbt
构建。我想用sftp
将项目发布到远程服务器。我不想输入每个publish
我的用户名和密码,所以我决定使用位于~/.ivy2/.credentials
的文件.credentials
。问题是.credentials
文件被忽略,因为在每个publish
操作中,我需要给我的用户名和密码。sbt使用凭证发布到远程服务器
build.sbt
name := "myproject"
version := "1.0"
scalaVersion := "2.11.7"
resolvers += "Sonatype Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots/"
resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"
libraryDependencies ++= Seq(
"com.amazonaws" % "aws-java-sdk" % "1.10.12",
"com.typesafe.play" %% "play-json" % "2.3.4",
"org.reactivemongo" %% "play2-reactivemongo" % "0.10.5.0.akka23",
"com.typesafe" % "config" % "1.3.0",
"com.github.nscala-time" %% "nscala-time" % "2.6.0"
)
coverageEnabled := true
publishMavenStyle := true
val keyFile: File = new File(sys.env("HOME") + "/.ssh/id_rsa")
publishTo := Some(Resolver.sftp("Maven Repository","example.com","/data/www/example.com/html"))
credentials += Credentials(Path.userHome/".ivy2"/".credentials")
isSnapshot := true
〜/ .ivy2/.credentials
realm=Maven Repository
host=example.com
user=user
password=foobar
我需要做什么才能解决这个问题做什么呢?
我没有看到keyFile或证书的使用位置,但[documentation](http://www.scala-sbt.org/0.12 .1/docs/Detailed-Topics/Resolvers.html)以这种方式指定'resolvers + = Resolver.ssh(“my-ssh-repo”,“example.org”)作为(“user”,“password”)。我相信这同样适用于sftp –
您的解决方案可以工作,但我不想将密码放入'build.sbt'中。另外,这个证书将被几个scala项目使用。这就是为什么我想要存储到如下所述的文件中:http://www.scala-sbt.org/0.13.5/docs/Detailed-Topics/Publishing.html。然后,正确地添加我的示例中的凭据。 – alifirat