Publish sbt Artifacts

JFrog Artifactory Documentation

Products
JFrog Artifactory
Content Type
User Guide

You can publish two kinds of sbt artifacts:

Publish a Release

To configure sbt to publish a release to Artifactory, add this snippet to your build.sbt:

publishTo := Some("Artifactory Realm" at "https://[JFrogPlatformURL]/artifactory/<REPO_NAME>")
credentials += Credentials("Artifactory Realm", "[JFrogPlatformURL]", "<USERNAME>", "<AUTH>")

Where:

  • [JFrogPlatformURL]: The URL of your JPD. In the credentials function, provide only the hostname without protocol

  • <REPO_NAME>: The name of the target repository

  • <USERNAME>: Your Artifactory username

  • <AUTH>: Your Artifactory identity token

For example:

publishTo := Some("Artifactory Realm" at "https://company.jfrog.io/artifactory/sbt-maven-local")
credentials += Credentials("Artifactory Realm", "company.jfrog.io", "jeffry", "51HnvD0A1g2q3n4b5F6g7H8j9K0l1m2N3o4P5q6R7s8T9u0V1w2X3y4")

After adding this configuration, sbt publish commands will publish to Artifactory.

Note

You can also use JFrog Set me up to copy the snippet populated with your token and environment. For more information, see Use Artifactory Set Me Up for Configuring Package Manager Clients.

Publish a Snapshot

To publish a snapshot, add this snippet to your build.sbt:

publishTo := Some("Artifactory Realm" at "https://[JFrogPlatformURL]/artifactory/<REPO_NAME>;build.timestamp=" + new java.util.Date().getTime)
credentials += Credentials("Artifactory Realm", "[JFrogPlatformURL]", "<USERNAME>", "<AUTH>")

Where:

  • [JFrogPlatformURL]: The URL of your JPD. In the credentials function, provide only the hostname without protocol

  • <REPO_NAME>: The name of the target repository

  • <USERNAME>: Your Artifactory username

  • <AUTH>: Your Artifactory identity token

For example:

publishTo := Some("Artifactory Realm" at "https://company.jfrog.io/artifactory/sbt-maven-local;build.timestamp=" + new java.util.Date().getTime)
credentials += Credentials("Artifactory Realm", "company.jfrog.io", "jeffry", "51HnvD0A1g2q3n4b5F6g7H8j9K0l1m2N3o4P5q6R7s8T9u0V1w2X3y4")

After adding this configuration, sbt publish commands will publish to Artifactory.

Note

You can also use JFrog Set me up to copy the snippet populated with your token and environment. For more information, see Use Artifactory Set Me Up for Configuring Package Manager Clients.