我正在尝试使用 maven发布插件来创建一个发布版本的Java项目,其中 Perforce 作为SCM。
我的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>
我还使用 P4Maven 插件和Maven Release插件:
<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>
当调用'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]
有什么想法吗?
我可以致电mvn scm:checkout
。
答案 0 :(得分:2)
您需要将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>
答案 1 :(得分:0)
事实证明,P4Maven不是开箱即用的。我必须从Perforce页面下载它并将其安装到我的存储库中(按照下载zip文件中的说明)。之后,我可以成功使用p4
作为SCM提供商。
答案 2 :(得分:0)
我最近在这里做了:
<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>
然后是一些有用的命令:
mvn scm:changelog -Dusername=yourP4user -Dpassword=yourP4pwd
release:prepare -Dusername=yourP4user -Dpassword=yourP4pwd -autoVersionSubmodules=true -DignoreSnapshots=true