SBT解析因常春藤额外属性而失败

SBT解析因常春藤额外属性而失败,sbt,Sbt,我正在尝试将常春藤的额外属性用于SBT。我有两个模块:foo模型和fooapi。对于这两个版本,我都将其添加到build.sbt: projectID <<= projectID { id => id extra("branch" -> "master-api-model-separation") } 但是,当我尝试运行SBT(更新或包)时,我得到以下结果: [warn] :::::::::::::::::::::::::::::::::::::::::::::

我正在尝试将常春藤的额外属性用于SBT。我有两个模块:foo模型和fooapi。对于这两个版本,我都将其添加到
build.sbt

projectID <<= projectID { id =>
   id extra("branch" -> "master-api-model-separation")
}
但是,当我尝试运行SBT(更新或包)时,我得到以下结果:

[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: com.foo#foo-model;1.0: java.text.ParseException: inconsistent module descriptor file found in 'http://xdctest-app-01:8081/artifactory/foo-master/com/foo/foo-model/1.0/foo-model-1.0.pom': bad branch found in http://xdctest-app-01:808/artifactory/foo-master/com/foo/foo-model/1.0/foo-model-1.0.pom: expected='master-api-model-separation' found='null';
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn] 
[warn]  Note: Some unresolved dependencies have extra attributes.  Check that these dependencies exist with the requested attributes.
[warn]          com.foo:foo-model:1.0 (branch=master-api-model-separation)
[warn] 
还有一个例外和一个错误。我尝试使用SBT 0.13.0和0.13.1

我没有获得更有用的调试输出。我仅从最后一个命令中获得:

[debug]                 tried http://xdctest-app-01:8081/artifactory/foo-master/com/foo/foo-model/1.0/foo-model-1.0.jar
[debug] com.foo#foo-model;1.0 is changing, but has not changed: will trust cached artifacts if any
[debug] Deleting additional old artifacts from cache for changed module com.foo#foo-model;1.0:
[debug]         
[error]         foo-master: bad branch found in http://xdctest-app-01:8081/artifactory/foo-master/com/foo/foo-model/1.0/foo-model-1.0.pom: expected='master-api-model-separation' found='null'
[debug] problem occurred while resolving dependency: com.foo#foo-model;1.0 {compile=[default(compile)]} with foo-master: java.text.ParseException: inconsistent module descriptor file found in 'http://xdctest-app-01:8081/artifactory/foo-master/com/foo/foo-model/1.0/foo-model-1.0.pom': bad branch found in http://xdctest-app-01:8081/artifactory/foo-master/com/foo/foo-model/1.0/foo-model-1.0.pom: expected='master-api-model-separation' found='null';
[debug]         at org.apache.ivy.plugins.resolver.BasicResolver.checkDescriptorConsistency(BasicResolver.java:640)
[debug]         at org.apache.ivy.plugins.resolver.BasicResolver.getDependency(BasicResolver.java:284)
[debug]         at org.apache.ivy.plugins.resolver.IBiblioResolver.getDependency(IBiblioResolver.java:503)
[debug]         at sbt.ConvertResolver$PluginCapableResolver$1.sbt$ConvertResolver$DescriptorRequired$$super$getDependency(ConvertResolver.scala:28)
...
位于上述URL的POM文件确实存在,其内容在上面引用,即它具有值为master api model separation的分支属性


我做错了什么?

Ivy extra属性可能需要一个Ivy存储库才能让它工作,如果您使用的是Artifactory,它应该可以工作。sbt在内部使用额外的属性对Maven存储库上的Scala版本进行编码,但我不知道这些位是否公开

这是我用来做测试的

build.sbt
lazy val root=(文件中的项目(“.”)。
背景(
此生成中的bintrayReleaseOnPublish:=false
)
val customPattern=“[organization]/[module]/”+
“(scala_uu[scalaversation]/)(sbt_u[sbtVersion]/)(branch_u[branch_name]/)”+
“[revision]/[type]s/[artifact]([classifier])[ext]”
lazy val libExtra=(文件中的项目(“libExtra”))。
背景(
版本:=“0.1”,
scalaVersion:=“2.11.7”,
组织机构:=“com.example”,
名称:=“somelibrary”,
投影d:={
val previous=projectd.value
上一个.extra(“分支机构名称”->“主api模型分离”)
},
许可证+=(“MIT”,url(“http://opensource.org/licenses/MIT")),
BintrayVCURL:=一些(“git@github.com:you/your repo.git“,
B运输组织:=无,
bintrayRepository:=“测试”,
publishMavenStyle:=假,
发布中的校验和:=零,
publishTo:={
一些(URLRepository(“test bintray常春藤”),模式(
s“https://api.bintray.com/content/you/${bintrayRepository.value}/“+
定制模式+
s“bt_包={normalizedName.value};bt_版本={version.value}”))
}
)
lazy val app=(文件中的项目(“app”))。
背景(
scalaVersion:=“2.11.7”,
组织:=“foo”,
libraryDependencies+=“com.example”%%“somelibrary”%%“0.1”额外(“分支机构名称”->“主api模型分离”),
解析程序+=解析程序.url(“test bintray ivy”),url(“https://dl.bintray.com/you/test-test-test/)模式(
客户模式),
FullResolver:=FullResolver.value.filterNot(uz.name==“项目间”)
)
project/build.properties 项目/bintray.sbt libExtra/src/main/scala/Something 一半的设置基本上是设置为发布到虚拟的Bintray存储库中进行测试。以下是一些注意事项:

  • 分支机构的名称已被使用,因此我认为您不能使用它。我是sugin
    分支机构名称
  • publishTo包含一个自定义工件模式,该模式包含嵌入URL中的额外属性
使用
app
我能够从Bintray解析JAR:

app> compile
[info] Updating {file:/Users/xxx/extra-attribute-test/}app...
[info] Resolving jline#jline;2.12.1 ...
[info] downloading https://dl.bintray.com/eed3si9n/test-test-test/com/example/somelibrary_2.11/branch_master-api-model-separation/0.1/jars/somelibrary_2.11.jar ...
未来的改进:下面是我尝试使用Maven回购来实现这一点的尝试-

您尝试过使用吗?在我看来,不同之处在于,默认情况下,SBT使用ApacheIvy解析器——因此它可以与Artifactory一起工作。使用Maven插件解析器,它可以与Sonatype存储库一起工作;然而,我有人工制品的问题。奇怪的是,使用POM额外属性似乎对所使用的存储库(Sonatype、Artifactory)很敏感。
[debug]                 tried http://xdctest-app-01:8081/artifactory/foo-master/com/foo/foo-model/1.0/foo-model-1.0.jar
[debug] com.foo#foo-model;1.0 is changing, but has not changed: will trust cached artifacts if any
[debug] Deleting additional old artifacts from cache for changed module com.foo#foo-model;1.0:
[debug]         
[error]         foo-master: bad branch found in http://xdctest-app-01:8081/artifactory/foo-master/com/foo/foo-model/1.0/foo-model-1.0.pom: expected='master-api-model-separation' found='null'
[debug] problem occurred while resolving dependency: com.foo#foo-model;1.0 {compile=[default(compile)]} with foo-master: java.text.ParseException: inconsistent module descriptor file found in 'http://xdctest-app-01:8081/artifactory/foo-master/com/foo/foo-model/1.0/foo-model-1.0.pom': bad branch found in http://xdctest-app-01:8081/artifactory/foo-master/com/foo/foo-model/1.0/foo-model-1.0.pom: expected='master-api-model-separation' found='null';
[debug]         at org.apache.ivy.plugins.resolver.BasicResolver.checkDescriptorConsistency(BasicResolver.java:640)
[debug]         at org.apache.ivy.plugins.resolver.BasicResolver.getDependency(BasicResolver.java:284)
[debug]         at org.apache.ivy.plugins.resolver.IBiblioResolver.getDependency(IBiblioResolver.java:503)
[debug]         at sbt.ConvertResolver$PluginCapableResolver$1.sbt$ConvertResolver$DescriptorRequired$$super$getDependency(ConvertResolver.scala:28)
...
sbt.version=0.13.8
addSbtPlugin("me.lessis" % "bintray-sbt" % "0.3.0")
object Something
app> compile
[info] Updating {file:/Users/xxx/extra-attribute-test/}app...
[info] Resolving jline#jline;2.12.1 ...
[info] downloading https://dl.bintray.com/eed3si9n/test-test-test/com/example/somelibrary_2.11/branch_master-api-model-separation/0.1/jars/somelibrary_2.11.jar ...