2

我正在尝试从 Nexus maven repo 迁移到使用https://github.com/jcaddel/maven-s3-wagon。上马车?我已经阅读了一些关于 SBT 构建脚本的内容,但这似乎不是我想要的……我错过了什么吗?文档很少。

这是我的游戏!2.0 构建.scala 文件:

import sbt._
import Keys._
import PlayProject._

object ApplicationBuild extends Build {

  val appName = "my-play-app"
  val appVersion = "1.0-SNAPSHOT"

  val appDependencies = Seq(
    "org.fusesource.mqtt-client" % "mqtt-client" % "1.0")

  val main = PlayProject(appName, appVersion, appDependencies, mainLang = SCALA).settings(
    resolvers ++= Seq(
      "Maven Repository" at "http://repo1.maven.org/maven2/",
      "fusesource.snapshots" at "http://repo.fusesource.com/nexus/content/repositories/snapshots",
      "fusesource.releases" at "http://repo.fusesource.com/nexus/content/groups/public"))
}

这是我需要从 pom.xml 文件转换为 Build.scala 的内容(通过 wagon wiki):

<build>
 <extensions>
  <extension>
    <groupId>org.kuali.maven.wagons</groupId>
    <artifactId>maven-s3-wagon</artifactId>
    <version>[S3 Wagon Version]</version>
  </extension>
 </extensions>
</build>

<distributionManagement>
 <site>
  <id>s3.site</id>
  <url>s3://[AWS Bucket Name]/site</url>
 </site>
 <repository>
  <id>s3.release</id>
  <url>s3://[AWS Bucket Name]/release</url>
 </repository>
 <snapshotRepository>
  <id>s3.snapshot</id>
  <url>s3://[AWS Bucket Name]/snapshot</url>
 </snapshotRepository>
</distributionManagement>

我想我了解如何将分发部分添加到 Build.scala:

    import sbt._
    import Keys._
    import PlayProject._

    object ApplicationBuild extends Build {

      val appName = "my-play-app"
      val appVersion = "1.0-SNAPSHOT"

      val appDependencies = Seq(
        "org.fusesource.mqtt-client" % "mqtt-client" % "1.0")

      val main = PlayProject(appName, appVersion, appDependencies, mainLang = SCALA).settings(
        resolvers ++= Seq(
          "Maven Repository" at "http://repo1.maven.org/maven2/",
          "fusesource.snapshots" at "http://repo.fusesource.com/nexus/content/repositories/snapshots",
          "fusesource.releases" at "http://repo.fusesource.com/nexus/content/groups/public",
          "s3.site" at "s3://[AWS Bucket Name]/site",
          "s3.release" at "s3://[AWS Bucket Name]/release",
          "s3.snapshot" at "s3://[AWS Bucket Name]/snapshot"))
    }
4

4 回答 4

1

看起来 sbt 中仍然没有自动 S3 发布支持(尽管有s3-plugin)。但我认为你可以很容易地创建自己的,因为

  1. sbt 可以通过插件增强
  2. Maven 插件只是 POJO(因此您可以在 Maven 之外轻松地重用它们)
  3. 有一个现有的 Maven 插件已经可以满足您的需求

我想你可以

  1. 使用sbt 发布插件...
  2. ...添加您自己的自定义发布步骤...
  3. ...调用S3Wagon.putResourceS3Plugin.S3.s3Settings.upload
于 2013-09-20T10:07:21.327 回答
1

sbt-aether-deploymaven-s3-wagonfmt-sbt-s3-resolver 的组合对我来说效果很好

构建.sbt:

publishMavenStyle := true

publishTo <<= version { v: String =>

  if (v.trim.endsWith("SNAPSHOT"))
    Some("Snapshots" at "s3://myrepo/snapshots")
  else
    Some("Releases" at "s3://myrepo/releases")
}

aetherSettings

aetherPublishSettings

wagons := Seq(aether.WagonWrapper("s3", "org.kuali.maven.wagon.S3Wagon"))

插件.sbt:

addSbtPlugin("no.arktekk.sbt" % "aether-deploy" % "0.13")

addSbtPlugin("com.frugalmechanic" % "fm-sbt-s3-resolver" % "0.4.0")

libraryDependencies += "org.kuali.maven.wagons" % "maven-s3-wagon" % "1.2.1"

fm-sbt-s3-resolver用于解析 s3 依赖项和用于部署的以太。单独使用fm-sbt-s3-resolver部署不会 AFAIK 生成和发布元数据(maven-metadata.xml)

于 2014-12-08T19:49:37.210 回答
0

Sbt 不支持 maven 扩展,这为您提供了 s3:// 协议,所以简而言之,没有简单的方法可以做您想做的事情

于 2012-05-02T05:57:29.420 回答
0

有一个用于 sbt 的 S3 插件可用。

于 2013-09-20T10:01:07.623 回答