SBT无法在Artifactory maven存储库中找到快照

mse*_*don 6 scala sbt

我刚刚开始尝试使用scala和sbt设置工作流程,而我的存储库遇到了问题.我正在尝试发布一个简单的测试库,它由两个项目组成,并从另一个程序中使用它.

我的源库的构建包含以下内容:

val sharedSettings = Seq(
  name := "test-lib",
  organization := "com.example",
  version := "0.1-SNAPSHOT",
  scalaVersion := "2.11.0",
  publishTo := Some("Artifactory Realm" at "http://localhost:8081/artifactory/libs-snapshot-local"),
  publishMavenStyle := true,
  credentials += Credentials(Path.userHome / ".ivy2" / ".credentials")
)

lazy val root = project.in(file(".")).settings(sharedSettings: _*).aggregate(child1, child2)

lazy val sharedCode = project.settings(sharedSettings: _*)

val child1Settings = sharedSettings ++ Seq(unmanagedSourceDirectories in Compile <++= (unmanagedSourceDirectories in sharedCode) in Compile)

val child2Settings = sharedSettings ++ Seq(unmanagedSourceDirectories in Compile <++= (unmanagedSourceDirectories in sharedCode) in Compile)

lazy val child1 = project.settings(child1Settings: _*)

lazy val child2 = project.settings(child2Settings: _*)
Run Code Online (Sandbox Code Playgroud)

我可以运行sbt publish okay,它会com/example/test-lib/XXX在repo中创建目录.

在我的测试程序中,我有以下内容:

scalaVersion := "2.11.0",

resolvers += "Artifactory Realm" at "http://localhost:8081/artifactory/libs-snapshot-local",

libraryDependencies += "com.example" %% "test-lib" % "0.1-SNAPSHOT"
Run Code Online (Sandbox Code Playgroud)

当测试程序尝试编译时com.example,由于以下原因,它无法解析:

[warn] ==== Artifactory Realm: tried
[warn]   http://localhost:8081/artifactory/libs-snapshot-local/com/example/test-lib_2.11/0.1-SNAPSHOT/test-lib_2.11-0.1-SNAPSHOT.pom
Run Code Online (Sandbox Code Playgroud)

查看存储库目录本身,我在我的pom文件上获得了一个额外的时间戳:

test-lib_2.11-0.1-20140510.183027-1.pom               10-May-2014 19:30  793 bytes
test-lib_2.11-0.1-20140510.183027-2.pom               10-May-2014 19:30  793 bytes
...
test-lib_2.11-0.1-20140510.183121-9.pom               10-May-2014 19:31  793 bytes
Run Code Online (Sandbox Code Playgroud)

目录中的maven-metadata.xml引用这些正常,sbt直接查找没有时间戳的pom文件,但无法找到它.pom文件包含正确的信息.

我究竟做错了什么?

mse*_*don 6

问题不在于我的sbt配置,而在于我的存储库服务器.

我正在使用Artifactory,并且快照存储库配置为默认使用"唯一快照".这些快照的文件名在发布时进行了修改,以包含时间戳,sbt 13.x似乎无法理解.

将存储库的"Maven Snapshot Version Behavior"从"Unique"更改为"Nonunique"后,一切都开始起作用了.