问题描述
这个不错的小工具承诺可以帮助我将工件上传到私有Bitbucket存储库中.
This nice little tool promise help me upload artifacts up to a private Bitbucket repo.
http://synergian.github.io/wagon-git/bitbucket.html
我在Gradle版本中使用此指南时遇到麻烦...
I am having troubles using this guide in my Gradle build...
我找到了这个简短而有限的例子, https://github.com/UniconLabs/ssl-utils/blob/master/build.gradle
I've found this short and limited example, https://github.com/UniconLabs/ssl-utils/blob/master/build.gradle
对我来说最不清楚的部分是有关如何在Maven主页中准备settings.xml的内容.自从我与Gradle合作以来,我应该使用我的.gradle文件夹吗?
Most unclear for me is this section about how to prepare the settings.xml inside my maven home. Am I supposed to use my .gradle folder instead since I work with Gradle?
以相同的方式进行操作,但是在您的Maven中添加基本身份验证settings.xml(通常位于$ MAVEN_HOME目录中,请查看 http://maven.apache.org/settings.html 以获得完整指南).
Proceed the same way, but add basic authentication in your Maven settings.xml (usually located at your $MAVEN_HOME directory, check out http://maven.apache.org/settings.html for a full guide).
<settings>
...
<servers>
<server>
<id>your-repo-id</id>
<username>yourbitbucketusername</username>
<password>yourbitbucketpassword</password>
</server>
...
</servers>
...
</settings>
推荐答案
最简单的方法是转到您的〜/.gradle/gradle.properties文件,并添加以下两行:
Easiest thing to do is go to your ~/.gradle/gradle.properties file, and add the following two lines:
yourbitbucketusername = [bitbucket username]
yourbitbucketpassword = [bitbucket password]
然后,您可以在build.gradle中添加以下内容:
Then you can add the following in your build.gradle:
uploadArchives {
repositories {
mavenDeployer {
repository(url: "repo url") {
authentication(userName: yourbitbucketusername,
password: yourbitbucketpassword)
}
这篇关于wagon-git和Gradle的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!