简体   繁体   English

如何使用Maven中的sbt指定存储库的凭据?

[英]How to specify credentials for repository with sbt from maven?

I have following maven config. 我有以下Maven配置。 How can I translate it to sbt 1.x ? 如何将其转换为sbt 1.x? I attempted with adding credential in ~/.sbt/1.0/plugins/credentials.sbt file and it failed. 我尝试在〜/ .sbt / 1.0 / plugins / credentials.sbt文件中添加凭据,但失败了。 How can I correctly translate it to sbt ? 如何正确将其转换为sbt?

~/.m2/settings.xml 〜/ .m2目录/ settings.xml中

<servers>
<server>
    <id>PLATFORM_REPO</id>
    <username>myuser</username>
    <password>mypass</password>
</server>
</servers>

pom.xml 的pom.xml

<repositories>
<repository>
    <releases>
        <enabled>true</enabled>
    </releases>
    <snapshots>
        <enabled>false</enabled>
    </snapshots>
    <id>PLATFORM_REPO</id>
    <name>Platform Repository</name>
    <url>https://my.platform.com/artifactory/myrepo</url>
</repository>
</repositories>

It's not a plugin but something that mixes into your build. 它不是插件,而是可以混入您的构建中的东西。 So that information, if you want to have it globally available, should be in ~/.sbt/1.0/credentials.sbt (not inside a plugins subdirectory): 因此,该信息(如果要使其在全球范围内可用)应该位于~/.sbt/1.0/credentials.sbt (不在plugins子目录中):

credentials += Credentials("Platform Repository", 
  "my.platform.com/artifactory/myrepo", "myuser", "mypass")

Then in your build.sbt : 然后在您的build.sbt

publishTo := Some("Platform Repository" at 
  "https://my.platform.com/artifactory/myrepo")

See also: http://www.scala-sbt.org/1.x/docs/Publishing.html 另请参阅: http : //www.scala-sbt.org/1.x/docs/Publishing.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM