【发布时间】:2014-12-21 22:00:54
【问题描述】:
我无法使 maven-release 插件与 Perforce 一起工作。 release:prepare 似乎工作正常:创建了一个 Perforce 标签,它包含正确的文件。然而,当我运行 release:perform 时它失败了,因为目标/签出目录是空的。
我做了一些实验。如果我只同步到我的 pom.xml 然后运行 mvn scm:结帐 然后我的其他文件被检出到 P4 根目录中,就像我做了一个 p4同步... 然而 Maven 输出 [INFO] 结帐工作目录:/home/chris/perforce/pips/target/checkout [信息] 同步 -f //仓库/点数/... Maven 认为它正在检查目标/检查,但事实并非如此。我稍微研究了一下 P4Maven 代码,并在 P4Executor.java 中注意到了这一点
public String getRepoPath(P4ScmProviderRepository repo, File basedir) {
// Handles a case where executing release:prepare on a module with an
// invalid SCM location. The release.properties contains the invalid URL
// for checkout during release:perform and the basedir is not the module
// root. So, the trailing target/checkout directory must be removed.
if (basedir.toString().replace('\\', '/').endsWith("/target/checkout")) {
String dir = basedir.toString();
basedir = new File(dir.substring(0, dir.length()
- "/target/checkout".length()));
if (getLogger().isDebugEnabled()) {
logger.debug("Fixing checkout URL: " + basedir);
}
}
这段代码很清楚。 P4Maven 不会签出目标/签出。如果您告诉它结帐到目标/结帐,它将简单地删除“目标/结帐”并结帐到根目录。这与我看到的所做的一致。当我运行 release:perform
时,我还会看到“Fixing checkout URL”消息那么人们如何解决这个问题?
下面是我的 pom.xml。我在用 Perforce 服务器版本:P4D/LINUX26X86_64/2014.2/935585 (2014/09/16)。 p4d 在本地运行。身份验证被禁用,我不需要密码。 Nexus 2.10.0-02 在本地运行。 Ubuntu Linux。 Maven 3.2.3 java 1.7.0_55
谢谢。
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.ap
ache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.icap</groupId>
<artifactId>pips</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>pips</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<scm>
<connection>scm:p4:192.168.1.8:1666://depot/pips</connection>
<developerConnection>scm:p4:192.168.1.8:1666://depot/pips</developerConnection>
</scm>
<build>
<plugins>
<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>chelck</username>
<includes>**</includes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.1</version>
<dependencies>
<!-- P4Maven -->
<dependency>
<groupId>com.perforce</groupId>
<artifactId>p4maven</artifactId>
<version>[2011,2012)</version>
</dependency>
</dependencies>
<configuration>
<connectionType>connection</connectionType>
<username>chelck</username>
<includes>**</includes>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<fork>true</fork>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<distributionManagement>
<repository>
<id>deployment</id>
<name>Internal Releases</name>
<url>http://localhost:8081/nexus/content/repositories/releases/</url>
</repository>
<snapshotRepository>
<id>deployment</id>
<name>Internal Releases</name>
<url>http://localhost:8081/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>
</project>
【问题讨论】:
标签: maven perforce maven-release-plugin