NetsOSS / sbt-aether-deploy

Deploy SBT artifacts using Sonatype Aether

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SBT aether deploy plugin

Deploys sbt-artifacts using Eclipse aether. Aether is the same library as maven itself uses, meaning that the same behaviour should be expected.

project/plugins.sbt

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

Build file

import aether.Aether._
  
publishTo <<= (version: String) {
  if (version.endsWith("SNAPSHOT") {
    Some("Sonatype Nexus Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots")
  }
  else {
    Some("Sonatype Nexus Staging" at "https://oss.sonatype.org/service/local/staging/deploy/maven2")
  }
}

seq(aetherSettings: _*)

Override default publish/publish-local task

seq(aetherPublishSettings: _*)

Add credentials

credentials += Credentials(Path.userHome / ".sbt" / ".credentials")

Usage

To deploy to remote Maven repository.

sbt aether-deploy

To deploy to local maven repository.

sbt aether-install

Usage if the publish/publish-local task is overriden

To deploy to remote Maven repository.

sbt publish

To deploy to local maven repository.

sbt publish-local

Proxies

Documentation for proxies can be found here

Using the plugin with sbt-pgp-plugin 0.8

Previously the sbt-pgp-plugin hooked into the published-artifacts task, and this plugin does the same. This is no longer the case.

Workaround until code is updated

seq(aetherSettings: _*)

aetherArtifact <<= (coordinates, Keys.`package` in Compile, makePom in Compile, com.typesafe.sbt.pgp.PgpKeys.signedArtifacts in Compile) map {
  (coords: aether.MavenCoordinates, mainArtifact: File, pom: File, artifacts: Map[Artifact, File]) =>
    aether.Aether.createArtifact(artifacts, pom, coords, mainArtifact)
}

This should now allow aether-deploy task to work with the sbt-pgp-plugin

Overriding the publish-signed task

publishSigned <<= deploy

Using .scala file

To use the plugin in a .scala file you have to import it like this:

import aether.Aether._

About

Deploy SBT artifacts using Sonatype Aether


Languages

Language:Scala 100.0%