我正在使用maven发布插件和git over https,尝试使用jgit提供程序。
的pom.xml
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-scm-plugin</artifactId>
<version>${maven-scm-plugin.version}</version>
<configuration>
<providerImplementations>
<git>jgit</git>
</providerImplementations>
</configuration>
<dependencies>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-jgit</artifactId>
<version>${maven-scm-provider-jgit.version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>${maven-release-plugin.version}</version>
<configuration>
<providerImplementations>
<tagNameFormat>r@{project.version}</tagNameFormat>
<git>jgit</git>
</providerImplementations>
</configuration>
<dependencies>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-jgit</artifactId>
<version>${maven-scm-provider-jgit.version}</version>
</dependency>
</dependencies>
</plugin>
...
这就是我准备的方式:
mvn -X release:prepare -Dusername=whatever -Dpassword=whatever
这很好用,这里是命令输出的摘录:
...
[DEBUG] Goal: org.apache.maven.plugins:maven-release-plugin:2.5.1:prepare (default-cli)
[DEBUG] Style: Aggregating
[DEBUG] Configuration: <?xml version="1.0" encoding="UTF-8"?>
<configuration>
<addSchema default-value="true">${addSchema}</addSchema>
<allowReleasePluginSnapshot default-value="false">${allowReleasePluginSnapshot}</allowReleasePluginSnapshot>
<allowTimestampedSnapshots default-value="false">${ignoreSnapshots}</allowTimestampedSnapshots>
<arguments>${arguments}</arguments>
<autoVersionSubmodules default-value="false">${autoVersionSubmodules}</autoVersionSubmodules>
<basedir default-value="${basedir}"/>
<checkModificationExcludeList>${checkModificationExcludeList}</checkModificationExcludeList>
<commitByProject default-value="false">${commitByProject}</commitByProject>
<completionGoals default-value="">${completionGoals}</completionGoals>
<developmentVersion>${developmentVersion}</developmentVersion>
<dryRun default-value="false">${dryRun}</dryRun>
<generateReleasePoms default-value="false">${generateReleasePoms}</generateReleasePoms>
<javaHome default-value="${java.home}"/>
<localRepoDirectory default-value="${maven.repo.local}"/>
<mavenExecutorId default-value="invoker">${mavenExecutorId}</mavenExecutorId>
<mavenHome default-value="${maven.home}"/>
<password>${password}</password>
<pomFileName>${pomFileName}</pomFileName>
<preparationGoals default-value="clean verify">${preparationGoals}</preparationGoals>
<project default-value="${project}"/>
<projectVersionPolicyId default-value="default">${projectVersionPolicyId}</projectVersionPolicyId>
<providerImplementations>
<tagNameFormat>r@{project.version}</tagNameFormat>
<git>jgit</git>
</providerImplementations>
<pushChanges default-value="true">${pushChanges}</pushChanges>
<reactorProjects default-value="${reactorProjects}"/>
<releaseVersion>${releaseVersion}</releaseVersion>
<remoteTagging default-value="true">${remoteTagging}</remoteTagging>
<resume default-value="true">${resume}</resume>
<scmCommentPrefix default-value="[maven-release-plugin] ">${scmCommentPrefix}</scmCommentPrefix>
<session default-value="${session}"/>
<settings default-value="${settings}"/>
<suppressCommitBeforeTag default-value="false">${suppressCommitBeforeTag}</suppressCommitBeforeTag>
<tag>${tag}</tag>
<tagBase>${tagBase}</tagBase>
<tagNameFormat default-value="@{project.artifactId}-@{project.version}">${tagNameFormat}</tagNameFormat>
<updateDependencies default-value="true">${updateDependencies}</updateDependencies>
<updateWorkingCopyVersions default-value="true">${updateWorkingCopyVersions}</updateWorkingCopyVersions>
<useEditMode default-value="false">${useEditMode}</useEditMode>
<username>${username}</username>
<waitBeforeTagging default-value="0">${waitBeforeTagging}</waitBeforeTagging>
</configuration>
...
现在我开始执行:
mvn -X release:perform
这就是maven看到的:
[DEBUG] Goal: org.apache.maven.plugins:maven-release-plugin:2.5.1:perform (default-cli)
[DEBUG] Style: Aggregating
[DEBUG] Configuration: <?xml version="1.0" encoding="UTF-8"?>
<configuration>
<arguments>${arguments}</arguments>
<basedir default-value="${basedir}"/>
<connectionUrl>${connectionUrl}</connectionUrl>
<dryRun default-value="false">${dryRun}</dryRun>
<goals>${goals}</goals>
<javaHome default-value="${java.home}"/>
<localCheckout default-value="false">${localCheckout}</localCheckout>
<localRepoDirectory default-value="${maven.repo.local}"/>
<mavenExecutorId default-value="invoker">${mavenExecutorId}</mavenExecutorId>
<mavenHome default-value="${maven.home}"/>
<password>${password}</password>
<pomFileName>${pomFileName}</pomFileName>
<project default-value="${project}"/>
<reactorProjects default-value="${reactorProjects}"/>
<releaseProfiles>${releaseProfiles}</releaseProfiles>
<session default-value="${session}"/>
<settings default-value="${settings}"/>
<useReleaseProfile default-value="true">${useReleaseProfile}</useReleaseProfile>
<username>${username}</username>
<workingDirectory default-value="${project.build.directory}/checkout">${workingDirectory}</workingDirectory>
</configuration>
显然,providerImplementations
在第二个输出中不存在,并且maven正在尝试查找命令行git。我希望它因为没有用户名和密码而哭出来,但是当我刚刚将它添加到PATH的git路径时它起作用了吗?!
这是windows,maven 3.0.5,java 1.7.0_55 64位。
我想让它在没有命令行git的情况下运行。
有什么想法吗?谢谢!
答案 0 :(得分:0)
显然,发布执行目标不支持providerImplementations。
我在这里创建了一个问题,并为此错误提供了一个补丁: https://issues.apache.org/jira/browse/MRELEASE-921