将Perforce SCM配置到Maven项目中以获取最新的更改列表 [英] Configuring Perforce scm into maven project to get latest changelist

查看:116
本文介绍了将Perforce SCM配置到Maven项目中以获取最新的更改列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将项目迁移到Maven,并且由于我们总是通过Perforce SCM存储库中的最新更改号来引用我们的版本,因此我希望能够提取此信息

I am migrating a project to Maven and as we were used to always reference our builds by the latest change number in our Perforce SCM repository, I would like to be able to extract this information

我正在尝试通过以下资源配置Maven scm插件:

I am trying to configure Maven scm plugin via following resources:

  • http://maven.apache.org/scm/maven-scm-plugin/usage.html for generic usage
  • http://www.perforce.com/perforce/doc.current/manuals/p4maven/index.html

首先,我不知道如何使它工作,因此,如果有人有一个完整的示例,我会很乐意通过添加pom来尝试:

First I don't understand how to make it work, so if anybody has a fully working example, I will be happy to, on my side I have tried by adding in my pom:

<scm>
    <connection>
        scm:perforce:localhost:1666://depot/
        <my_project>
            /
            <version>
    </connection>
    <developerConnection>
        scm:perforce:localhost:1666:/depot/
        <my_project>
            /
            <version>
    </developerConnection>
    <url>http://somerepository.com/view.cvs</url>
</scm>
...
<plugins>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-scm-plugin</artifactId>
        <version>1.6</version>
        <dependencies>
            <!-- P4Maven -->
            <dependency>
                <groupId>com.perforce</groupId>
                <artifactId>p4maven</artifactId>
                <version>[2011,2012)</version>
            </dependency>
        </dependencies>
        <configuration>
            <connectionType>//depot/proto/kernel/kernel/04.00/maven2</connectionType>
            <username>my local username</username>
            <password>xxxxxx</password>
            <includes>**</includes>
        </configuration>
    </plugin>
</plugins>

这导致我:

[INFO] --- maven-scm-plugin:1.6:checkout (default-cli) @ kernel ---
mars 27, 2012 9:54:08 AM org.sonatype.guice.bean.reflect.Logs$JULSink warn
Avertissement: Error injecting: org.apache.maven.scm.provider.svn.svnexe.SvnExeScmProvider
java.lang.NoClassDefFoundError: org/apache/maven/scm/command/info/InfoScmResult

当然忘记了一些东西,我会尝试再次阅读说明,看看我想念的是什么,但是如果有人知道...

Surely forgot something, I will try to read again the instructions and see what I miss, but if anybody knows ...

无论如何,我的问题是:值得尝试吗? 在scm插件的可用操作中,我看不到任何能帮助我获取最新更改信息并将其集成到参考内部版本号的东西.我应该为此开发自己的插件吗?

Anyway, my question is rather: is it worth trying it ? I don't see in the available actions from scm plugin anything that will help me getting the last change information and integrate it into a reference build number. Shall I develop my own plugin for this ?

谢谢.

推荐答案

我从一位P4Maven开发人员那里得到了一些建议,可能会有所帮助.

I got some advice from one of the P4Maven developers that might help.

首先,检查您的配置. "标签中的"..."应为"标签中的标签名称之一(即"connection"或"developerConnection")

First, check your configuration. The "..." in the "" tag should be one of the tag names in the "" tag (i.e. "connection" or "developerConnection")

可以将Maven与Perforce SCM一起使用.

There two options to use Maven with Perforce SCM.

  1. 使用默认(内置)Maven Perforce SCM提供程序(基于p4命令行)

  1. Use the default (built-in) Maven Perforce SCM provider (p4 commandline based)

  • 请注意,您需要安装p4命令行可执行文件
  • 您可以使用环境变量或JVM参数来设置用户名和密码

[环境变量] P4CLIENT = P4USER = P4PASSWD =

[environment variables] P4CLIENT= P4USER= P4PASSWD=

[JVM args] -Dusername = -Dpassword =

[JVM args] -Dusername= -Dpassword=

[pom.xml] ...

[pom.xml] ...

  ...

  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-scm-plugin</artifactId>
    <version>1.4</version>
  </plugin>

  ...

...

 <!-- SCM Settings -->
  <scm>
    <connection>scmerforce:localhost:1666://depot/someproject</connection>
    <developerConnection>scmerforce:localhost:1666://depot/someproject</developerConnection>
    <url>scmerforce://depot/simple</url>
  </scm>

...

  1. 使用P4Maven Perforce SCM提供程序(基于P4Java)

[pom.xml]

[pom.xml]

...

...

  ...

  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-scm-plugin</artifactId>
    <version>1.4</version>
    <dependencies>
      <!-- P4Maven -->
      <dependency>
        <groupId>com.perforce</groupId>
        <artifactId>p4maven</artifactId>
        <version>[2011,2012)</version>
      </dependency>
    </dependencies>
    <configuration>
      <connectionType>connection</connectionType>
      <username>someuser</username>
      <password>somepassword</password>
      <includes>**</includes>
    </configuration>
  </plugin>

  ...

...

scm4:本地主机:1666://depot/someproject scm4:本地主机:1666://depot/someproject scm4://仓库/someproject

scm4:localhost:1666://depot/someproject scm4:localhost:1666://depot/someproject scm4://depot/someproject

...

  • 请注意,对于P4Maven,我们将覆盖"maven-scm-plugin"插件中的默认提供程序.

  • Note that for P4Maven we're overriding the default provider inside the "maven-scm-plugin" plugin.

请注意,由于现有的默认实现采用了"perforce",因此我们将使用"scmp4"(如果使用P4Maven)而不是"scmperforce"(内置默认值)作为提供程序名称.

Note that we're using "scmp4" (if using P4Maven) instead of "scmperforce" (built-in default) as the provider name, since "perforce" is taken by the existing default implementation.

这篇关于将Perforce SCM配置到Maven项目中以获取最新的更改列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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