我刚开始尝试使用scala和sbt设置工作流,并且遇到存储库问题。我试图发布一个简单的测试库,它由两个项目组成,并从另一个程序中使用它。SBT无法在Artifactory maven存储库中找到快照
我的源库的构建包含以下内容:
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: _*)
我可以SBT运行发布没关系,它会在回购目录com/example/test-lib/XXX
。
在我的测试程序中,我有以下几点:
scalaVersion := "2.11.0",
resolvers += "Artifactory Realm" at "http://localhost:8081/artifactory/libs-snapshot-local",
libraryDependencies += "com.example" %% "test-lib" % "0.1-SNAPSHOT"
当测试程序尝试编译,它无法解析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
望着仓库目录本身,我得到我的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
目录中的maven-metadata.xml引用了这些好的,sbt正在直接查找没有时间戳的pom文件,并且找不到它。 pom文件包含正确的信息。
我在做什么错?
它将'my-repo'视为常春藤风格的回购,但您已在样本中正确定义它作为maven样式回购。但是,您的输出显示为“my-repo”,而您的示例显示为“Artifactory Realm”,因此您在发布时修改了某些内容。我们可以看到原件,所以我们知道它的名字叫做“my-repo”。 – monkjack
好赶上!我早些时候搞乱了ivy vs maven repos,并且必须从错误的控制台窗口中复制它......实际上,我更了解这个问题,并将调整我的问题以反映这一点。 – mseddon
尝试向您的build.sbt添加publishMavenStyle:= true,这可能会在您发布时删除时间戳。 – monkjack