Can SBT publish to JFrog artifactory
Asked Answered
O

2

10

My organization uses JFROG artifactory for distribution of all jars.

So far I have always used SBT for my Scala development. But now when i am searching for ways to publish jars built by SBT into JFROG artifactory, I only find this plugin on github which is in "alpha" state

https://github.com/JFrogDev/artifactory-sbt-plugin

I want to know if this plugin is the only way to publish jars from sbt to JFrog artifactory? or are there better means.

since this plugin says that its in alpha... I don't think my org will be ready to use this.

What are others doing when using artifactory and scala? are you using maven xml to build and publish jars to artifactory?

Oldster answered 12/10, 2015 at 22:22 Comment(0)
S
18

SBT can publish/resolve from Artifactory without any special plugin.

For example, you can use the following in your build.sbt to publish released to Artifactory:

publishTo := Some("Artifactory Realm" at "http://localhost:8081/artifactory/libs-release-local")
credentials += Credentials("Artifactory Realm", "localhost", "<USERNAME>", "<PASS>")

Or the following to publish SNAPSHOTs (unique):

publishTo := Some("Artifactory Realm" at "http://localhost:8081/artifactory/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
credentials += Credentials("Artifactory Realm", "localhost", "<USERNAME>", "<PASS>")

If you are using Artifactory 4.x, you can use the "Set Me Up" feature for getting the required settings for working with SBT

enter image description here

Sedgemoor answered 15/10, 2015 at 8:33 Comment(2)
What if I want the master branch to publish to "releases", and another branch to publish to "snapshots"? I know how to make an sbt task to inspect the branch name, but publishTo is a setting, and in sbt a setting can't depend on a task.Cunning
Asked follow-up here: #37144550Cunning
S
6

Use ~/.sbt/.credentials way more secure and more flexible for developers and CI being on the same environment.

https://www.scala-sbt.org/1.x/docs/Publishing.html#Credentials

enter image description here

Saffian answered 12/11, 2019 at 15:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.