Maven的插件发布的git凭据 [英] Maven release plugin git credentials

查看:231
本文介绍了Maven的插件发布的git凭据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们使用的是詹金斯和基于文件的git回购只是切换无需验证使用GitBlit通过HTTP与正确的验证。

We are using Jenkins and just switched from a file based git repo without authentication to using GitBlit with proper authentication over http.

问题是 - ? Maven是应该如何将自己在批处理模式验证

更新每个作业与 -Dusername -Dpassword (因此存储作业的密码)没有按' ŧ显得非常可行的。我读过的settings.xml应该通过指定的Git服务器的ID与git的工作,但无论我做什么,没有任何作用(即释放插件提示输入凭据)。

Updating each job with -Dusername and -Dpassword (and thus storing the password in the jobs) doesn't seem very feasible. I've read that settings.xml is supposed to work with git by specifying the git server as the id, but whatever I do it has no effect (i.e the release plugin prompts for credentials).

<properties>
   <project.scm.id>git</project.scm.id>
</properties>
<scm>
   <connection>scm:git:http://myserver:8081/r/gitauthtest.git</connection>
   <developerConnection>scm:git:http://myserver:8081/r/gitauthtest.git</developerConnection>
</scm>

的settings.xml内容

<settings>  
   <servers>  
      <server>
         <id>git</id>  
         <username>myUser</username>  
         <password>myPassword</password>  
      </server>   
   </servers>
</settings>

有没有办法得到这个工作?我简直不敢相信如此简单和非常普遍的,因为这一个任务没有一个简单的标准溶液。

Is there any way to get this working? I cannot believe that a task as simple and extremely common as this doesn't have an easy standard solution.

推荐答案

根据上的文档你必须使用一个特殊的属性, project.scm.id ,定义适当的在你的settings.xml文件服务器条目。

Based on the docs you have to use a special property, project.scm.id, to define the id of the appropriate server entry in your settings.xml file.

<properties>
  <project.scm.id>my-scm-server<project.scm.id>
</properties>

而在你的settings.xml文件以下内容:

And the following in your settings.xml file:

<settings>  
   <servers>  
      <server>
         <id>my-scm-server</id>  
         <username>myUser</username>  
         <password>myPassword</password>  
      </server>   
   </servers>
</settings>

BTW:检查是否正在使用最新的版本Maven的释放插件。该project.scm.id增强在2.3版本中引入的票MRELEASE-420 。例如,如果你正在使用Maven 3.0.5那么你是在默认情况下只能使用Maven的释放插件的2.0版本。太旧。通过添加类似下面你POM修正:

BTW: Check if you are using the most recent version of maven-release-plugin. The project.scm.id enhancement was introduced in version 2.3 as part of ticket MRELEASE-420. For example if you are using Maven 3.0.5 then you are by default only using version 2.0 of the maven-release-plugin. Much too old. Fix by adding something like below to your POM:

<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>2.5.3</version>                
            </plugin>
        </plugins>
    </pluginManagement>
</build>

这篇关于Maven的插件发布的git凭据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆