A tiny sbt plugin to streamline resolving against JFrog Artifactory. Motivated by the sunsetting of Bintray.
This plugin uses itself to publish itself.
Install the plugin.
addSbtPlugin("net.rouly" % "sbt-artifactory" % "version")
Define your Artifactory connection.
artifactory := artifactoryCloud("mycompany") // https://mycompany.jfrog.io
artifactory := artifactoryHttps("artifacts.mycompany.biz")
artifactory := artifactoryHttps("artifacts.mycompany.biz", "/custom/path/to/artifactory")
artifactory := artifactoryHttp("insecure.artifacts.mycompany.biz")
artifactory := artifactoryHttp("insecure.artifacts.mycompany.biz", "/custom/path/to/artifactory")
Set your Artifactory credentials in the environment.
ARTIFACTORY_USER=
ARTIFACTORY_PASS=
You're done!
Add to your project/plugins.sbt
addSbtPlugin("net.rouly" % "sbt-artifactory" % "version")
Configure the connection for your Artifactory install.
artifactory := artifactoryCloud("mycompany") // https://mycompany.jfrog.io
artifactory := artifactoryHttps("artifacts.mycompany.biz")
artifactory := artifactoryHttps("artifacts.mycompany.biz", "/custom/path/to/artifactory")
artifactory := artifactoryHttp("insecure.artifacts.mycompany.biz")
artifactory := artifactoryHttp("insecure.artifacts.mycompany.biz", "/custom/path/to/artifactory")
It is recommended to use https
for artifact resolution.
No guarantee is made that http
will work for sbt versions 0.13
and below.
The plugin adds artifactoryCredentials
to your build's credentials
, based on the artifactory
setting.
By default, these credentials anticipate the environment variables ARTIFACTORY_USER
and ARTIFACTORY_PASS
.
You can also set your own credentials file.
The default credential realm is set to Artifactory Realm
but this can be overridden with artifactoryRealm
.
By default, the plugin will anticipate the repository names {ivy|maven}-{snapshot|release}-local
based on the values of publishMavenStyle
and isSnapshot
.
If these repository names don't work for you, you can override the settings.
artifactorySnapshotRepository := "custom-sbt-snapshot"
artifactoryReleaseRepository := "custom-sbt-release"
If you use a single repository for both snapshots and releases, just set the keys to the same value.
publishTo
is automagically configured and set to artifactoryResolver
.
It is aware of snapshot/release and ivy/maven settings by default.
You can reset publishTo
if the defaults don't work for you.
You can also add custom Artifactory resolvers for dependency resolution.
resolvers += Resolver.artifactoryIvyRepo(artifactory.value, "ivy-release")
resolvers += Resolver.artifactoryRepo(artifactory.value, "maven-release")
Key | Type | Description |
---|---|---|
artifactory |
ArtifactoryConnection |
Artifactory connection configuration. |
artifactoryRealm |
String |
Artifactory credential realm. Defaults to Artifactory Realm . |
artifactorySnapshotRepository |
String |
Artifactory snapshot repository label. Defaults to ivy-snapshot-local or maven-snapshot-local . |
artifactoryReleaseRepository |
String |
Artifactory release repository label. Defaults to ivy-release-local or maven-release-local . |
The next keys are derived from the previous table. You probably don't want to override these, but go ahead if you need to.
Key | Type | Description |
---|---|---|
artifactoryCredentials |
Credentials |
Artifactory credentials, derived from environment variables. |
artifactorySnapshotResolver |
Resolver |
Artifactory snapshot resolver. |
artifactoryReleaseResolver |
Resolver |
Artifactory release resolver. |
artifactoryResolver |
Resolver |
Artifactory publishTo resolver, switches between snapshot/release. |