简体   繁体   English

如何配置 maven-release 以使用 Perforce 作为 SCM 提供程序?

[英]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.

相关问题 如何配置 maven-release-plugin 以使用 maven-scm-provider-gitexe &#39;shallow&#39; 选项 - How to configure maven-release-plugin to use maven-scm-provider-gitexe 'shallow' option 如何有条件地运行maven-release:在jenkins中回滚? - How to conditionally run maven-release:rollback in jenkins? SCM 提供程序不可用 - Maven - SCM Provider not available - Maven 使用maven-release后无法在竹子中部署springboot jar - Unable to deploy springboot jar in bamboo after using maven-release Maven-release插件:版本中没有快照的分支 - Maven-release plugin: Branch without snapshot in version Maven与jenkins slave和Credentials一起发布:如何将SCM凭证传递给maven? - Maven release with jenkins slave and Credentials : how to pass SCM credentials to maven? Maven SCM不监听perforce触发输出 - maven scm does not listen to perforce trigger output 配置Maven scm插件以使用settings.xml中的serverID - Configure Maven scm plugin to use serverID from settings.xml 如何配置Maven或Eclipse以在版本中使用RELEASE常量? - How to configure maven or eclipse in order to use the RELEASE constant within versions? 如何在 Maven Release Plugin 中设置 SCM 标签? - How do I set the SCM tag in the Maven Release Plugin?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM