在自定义配置中的publishConfiguration中覆盖publishTo

时间:2013-12-11 16:25:00

标签: scala sbt

我想在我的配置publish中定义Deploy任务的自定义行为,方法是将publishTo更改为生产服务器解析程序,并在Default配置中保留默认解析程序以进行发布,所以我正在做以下事情:

def deploySettings = addArtifact(Artifact(projectName, "zip", "zip"), Dist.pack) ++ Seq(
  publishTo := Some((publishRepo in ThisBuild).value)
)

默认publish行为的设置(将项目发布到dev repo),我在范围deploy中也有一个名为Deploy的任务,publish调用publishTo 1}} Deploy配置中定义的设置:

private val deployConfig: Seq[Def.Setting[_]] = inConfig(Deploy) {
  ...
  publishTo in (Deploy, publishConfiguration) <<= destination { _ map { _.resolver } },
  publishConfiguration in (Deploy, publish) <<= (publishConfiguration in Deploy),
  publishTo in (Deploy, publish) <<= destination { _ map { _.resolver },
  ...
}

但这不起作用,当我致电deploydeploy:publish时,它会从*:publishTo设置发布到dev repo,如果我不在*:publishTo中提供deploySettings {1}}执行崩溃:

last project/*:publishConfiguration
java.lang.RuntimeException: Repository for publishing is not specified.
    at scala.sys.package$.error(package.scala:27)
    at sbt.Classpaths$$anonfun$getPublishTo$1.apply(Defaults.scala:1186)
    at sbt.Classpaths$$anonfun$getPublishTo$1.apply(Defaults.scala:1186)
    at scala.Option.getOrElse(Option.scala:120)
    at sbt.Classpaths$.getPublishTo(Defaults.scala:1186)
    at sbt.Classpaths$$anonfun$57.apply(Defaults.scala:1020)
    at sbt.Classpaths$$anonfun$57.apply(Defaults.scala:1020)

也许SBT尝试从默认配置中使用publishConfiguration初始化publishTo的问题?我应该更正为默认范围内的publish提供不同的解析程序,为deploy:publish提供另一个解析程序?

0 个答案:

没有答案