SBT - Resolvers
来源:互联网 发布:a5淘宝客论坛 编辑:程序博客网 时间:2024/06/05 02:53
SEE SBT docs here: http://www.scala-sbt.org/release/docs
Maven
Resolvers for Maven2 repositories are added as follows:
resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots"
This is the most common kind of user-defined resolvers. The rest of this page describes how to define other types of repositories.
Predefined
A few predefined repositories are available and are listed below
DefaultMavenRepository
This is the main Maven repository at https://repo1.maven.org/maven2/ and is included by defaultJavaNet1Repository
This is the Maven 1 repository at http://download.java.net/maven/1/Resolver.sonatypeRepo("public")
(or “snapshots”, “releases”) This is Sonatype OSS Maven Repository at https://oss.sonatype.org/content/repositories/publicResolver.typesafeRepo("releases")
(or “snapshots”) This is Typesafe Repository athttps://repo.typesafe.com/typesafe/releasesResolver.typesafeIvyRepo("releases")
(or “snapshots”) This is Typesafe Ivy Repository athttps://repo.typesafe.com/typesafe/ivy-releasesResolver.sbtPluginRepo("releases")
(or “snapshots”) This is sbt Community Repository athttps://repo.scala-sbt.org/scalasbt/sbt-plugin-releasesResolver.bintrayRepo("owner", "repo")
This is the Bintray repository athttps://dl.bintray.com/[owner]/[repo]/Resolver.jcenterRepo
This is the Bintray JCenter repository at https://jcenter.bintray.com/
For example, to use the java.net
repository, use the following setting in your build definition:
resolvers += JavaNet1Repository
Predefined repositories will go under Resolver going forward so they are in one place:
Resolver.sonatypeRepo("releases") // Or "snapshots"
Custom
sbt provides an interface to the repository types available in Ivy: file, URL, SSH, and SFTP. A key feature of repositories in Ivy is using patterns to configure repositories.
Construct a repository definition using the factory in sbt.Resolver
for the desired type. This factory creates a Repository
object that can be further configured. The following table contains links to the Ivy documentation for the repository type and the API documentation for the factory and repository class. The SSH and SFTP repositories are configured identically except for the name of the factory. Use Resolver.ssh
for SSH and Resolver.sftp
for SFTP.
Basic Examples
These are basic examples that use the default Maven-style repository layout.
Filesystem
Define a filesystem repository in the test
directory of the current working directory and declare that publishing to this repository must be atomic.
resolvers += Resolver.file("my-test-repo", file("test")) transactional()
URL
Define a URL repository at "https://example.org/repo-releases/"
.
resolvers += Resolver.url("my-test-repo", url("https://example.org/repo-releases/"))
To specify an Ivy repository, use:
resolvers += Resolver.url("my-test-repo", url)(Resolver.ivyStylePatterns)
or customize the layout pattern described in the Custom Layout section below.
SFTP and SSH Repositories
The following defines a repository that is served by SFTP from host "example.org"
:
resolvers += Resolver.sftp("my-sftp-repo", "example.org")
To explicitly specify the port:
resolvers += Resolver.sftp("my-sftp-repo", "example.org", 22)
To specify a base path:
resolvers += Resolver.sftp("my-sftp-repo", "example.org", "maven2/repo-releases/")
Authentication for the repositories returned by sftp
and ssh
can be configured by the as
methods.
To use password authentication:
resolvers += Resolver.ssh("my-ssh-repo", "example.org") as("user", "password")
or to be prompted for the password:
resolvers += Resolver.ssh("my-ssh-repo", "example.org") as("user")
To use key authentication:
resolvers += { val keyFile: File = ... Resolver.ssh("my-ssh-repo", "example.org") as("user", keyFile, "keyFilePassword")}
or if no keyfile password is required or if you want to be prompted for it:
resolvers += Resolver.ssh("my-ssh-repo", "example.org") as("user", keyFile)
To specify the permissions used when publishing to the server:
resolvers += Resolver.ssh("my-ssh-repo", "example.org") withPermissions("0644")
This is a chmod-like mode specification.
Custom Layout
These examples specify custom repository layouts using patterns. The factory methods accept an Patterns
instance that defines the patterns to use. The patterns are first resolved against the base file or URL. The default patterns give the default Maven-style layout. Provide a different Patterns object to use a different layout. For example:
resolvers += Resolver.url("my-test-repo", url)( Patterns("[organisation]/[module]/[revision]/[artifact].[ext]") )
You can specify multiple patterns or patterns for the metadata and artifacts separately. You can also specify whether the repository should be Maven compatible (as defined by Ivy). See the patterns API for the methods to use.
For filesystem and URL repositories, you can specify absolute patterns by omitting the base URL, passing an empty Patterns
instance, and using ivys
and artifacts
:
resolvers += Resolver.url("my-test-repo") artifacts "https://example.org/[organisation]/[module]/[revision]/[artifact].[ext]"
- SBT - Resolvers
- SBT
- SBT
- SBT!!
- SBT
- SBT
- SBT
- sbt
- SBT
- SpringMVC之HandlerMethodArgumentResolver和<mvc:argument-resolvers>
- SpringMVC之HandlerMethodArgumentResolver和<mvc:argument-resolvers>
- SBT(pet)
- 简单SBT
- SBT模板
- SBT 模板
- SBT poj3481
- sbt安装
- Maven SBT
- 队列,链队列,循环队列
- CocoaPods的安装,升级以及升级以后出现bug的解决方法(升级必看!)
- MySQL数据库自增主键归零的几种方法
- 【数据结构与算法】桶排序
- 《疯狂Android讲义》 -- Android 动画系列之补间(Tween)动画
- SBT - Resolvers
- $.ajax的beforeSend,success, complete,error例子
- 有关UIScrollView zoom的一点心得
- Yii2使用Bootbox插件自定义弹窗
- dialog弹出时自动弹出软键盘
- 算法前序
- 一天一个设计模式---解释器模式
- javascript数据类型和函数总结
- Python3.x