[英]How to configure maven-release to use Perforce as SCM provider?
I am trying to use the maven release plugin to create a released version of a Java project having Perforce as the SCM.我正在尝试使用maven 发布插件来创建一个 Java 项目的发布版本,该项目将Perforce作为 SCM。
My pom scm section is:我的 pom scm 部分是:
<scm>
<connection>scm:p4:myperforcehostname:1666://mydepot/mycomponent</connection>
<developerConnection>scm:p4:myperforcehostname:1666://mydepot/mycomponent</developerConnection>
<url>http://myperforcehostname:1666</url>
</scm>
Also I use the P4Maven plugin and the Maven Release Plugin:我还使用了P4Maven插件和 Maven 发布插件:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-scm-plugin</artifactId>
<version>1.4</version>
<dependencies>
<dependency>
<groupId>com.perforce</groupId>
<artifactId>p4maven</artifactId>
<version>[2011,2012)</version>
</dependency>
</dependencies>
<configuration>
<connectionType>connection</connectionType>
<username>myusernme</username>
<password>mypassword</password>
<includes>**</includes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5</version>
</plugin>
When calling 'mvn release:prepare -DdryRun=true' I get当调用 'mvn release:prepare -DdryRun=true' 我得到
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5:prepare
(default-cli) on project mycomponent: The provider given in the SCM URL could not be found:
No such provider: 'p4'. -> [Help 1]
Any ideas?有任何想法吗?
I am able to call mvn scm:checkout
.我可以调用mvn scm:checkout
。
You need to add the p4maven
as dependency to the maven-scm-plugin
as well as to the maven-release-plugin
.您需要将p4maven
作为依赖项添加到maven-scm-plugin
以及maven-release-plugin
。
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-scm-plugin</artifactId>
<version>1.4</version>
<dependencies>
<dependency>
<groupId>com.perforce</groupId>
<artifactId>p4maven</artifactId>
<version>[2011,2012)</version>
</dependency>
</dependencies>
<configuration>
<connectionType>connection</connectionType>
<username>username</username>
<password>password</password>
<includes>**</includes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5</version>
<dependencies>
<!-- P4Maven -->
<dependency>
<groupId>com.perforce</groupId>
<artifactId>p4maven</artifactId>
<version>[2011,2012)</version>
</dependency>
</dependencies>
<configuration>
<connectionType>connection</connectionType>
<username>username</username>
<password>password</password>
<includes>**</includes>
</configuration>
</plugin>
It turned out that P4Maven comes not out of the box.事实证明,P4Maven 并不是开箱即用的。 I had to download it from the Perforce pages and install it into my repository (following the instructions in the download zip file).我必须从 Perforce 页面下载它并将其安装到我的存储库中(按照下载 zip 文件中的说明进行操作)。 After that I could successfully use p4
as the SCM provider.之后,我可以成功地使用p4
作为 SCM 提供程序。
Here I done recently:我最近在这里做的:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-scm-plugin</artifactId>
<version>1.9.4</version>
<dependencies>
<dependency>
<groupId>com.perforce.p4maven</groupId>
<artifactId>p4maven-provider</artifactId>
<version>1.0.6</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
<dependencies>
<dependency>
<groupId>com.perforce.p4maven</groupId>
<artifactId>p4maven-provider</artifactId>
<version>1.0.6</version>
</dependency>
</dependencies>
</plugin>
And then some useful commands:然后是一些有用的命令:
mvn scm:changelog -Dusername=yourP4user -Dpassword=yourP4pwd
release:prepare -Dusername=yourP4user -Dpassword=yourP4pwd -autoVersionSubmodules=true -DignoreSnapshots=true
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.