Using Artifactory 5.x ?
JFrog Artifactory 5.x User Guide
Have a question? Want to report an issue? Contact JFrog support
Artifactory provides integration with sbt, allowing you to configure it to resolve dependencies from, and deploy build output to sbt repositories. All you need to do is make minor modifications to your
build.sbt configuration file.
A local sbt repository is used as a target to which you can deploy the output of your
build.sbt script. To create an sbt repository, set the Package Type to SBT.
A Remote Repository defined in Artifactory serves as a caching proxy for a registry managed at a remote URL.
Artifacts (such as JAR files) requested from a remote repository are cached on demand. You can remove downloaded artifacts from the remote repository cache, however, you can not manually deploy artifacts to a remote SBT repository.
To define a remote sbt repository to proxy a remote sbt registry follow the steps below:
- In the Admin module, under Repositories | Remote, click "New".
- In the New Repository dialog, set the Package Type to SBT, set the Repository Key value, and specify the URL to the remote registry in the URL field as displayed below:
- Click "Save & FInish"
The parameters needed to configure remote sbt repositories are identical to those used for Maven repositories. For more details, please refer to Type-Specific Basic Settings under Remote Repositories.
A Virtual Repository defined in Artifactory aggregates packages from both local and remote repositories.
This allows you to access both locally hosted JARS and remote proxied sbt registries from a single URL defined for the virtual repository.
To define a virtual sbt repository, create a virtual repository, set the Package Type to be sbt, and select the underlying local and remote sbt repositories to include in the Basic settings tab.
Click "Save & Finish" to create the repository.
The parameters needed to configure virtual sbt repositories are identical to those used for Maven repositories. For more details, please refer to Virtual Repositories.
To configure sbt to resolve and deploy artifacts through sbt repositories defined in Artifactory, simply select one of the sbt repositories in the Tree Browser and click Set Me Up. Artifactory will display code snippets you can use in the relevant sbt files.
Configuring Proxy Repositories
To configure a repository defined in Artifactory as a proxy repository for sbt, add the code snippet below to your
<host>:<port> are the host URL and port on which Artifactory is running.
For example, if you are running Artifactory on your local machine, on port 8081, and want to proxy Ivy repositories through a repository called
sbt-ivy-proxy, and proxy Maven repositories through a repository called
sbt-maven-proxy you would use:
Proxying Maven and Ivy repositories separately
To specify that all resolvers added in the sbt project should be ignored in favor of those configured in the repositories configuration, add the following configuration option to the sbt launcher script:
You can also add this setting to your /usr/local/etc/sbtopts
Configuring Artifact Resolution
To resolve artifacts through Artifactory, simply add the following code snippet to your
<host>:<port> are the host URL and port on which Artifactory is running, and repo-key is the Artifactory repository through which you are resolving artifacts
To deploy sbt build artifacts to repositories in Artifactory, add the following code snippets to your
For releases, add:
For snapshots, add:
<host>:<port> are the host URL and port on which Artifactory is running, and repo-key is the Artifactory repository to which you are deploying artifacts.
A sample SBT project that uses Artifactory is available on GitHub and can be freely forked.