【问题标题】:Something is wrong with Maven when I execute the command release:prepare执行命令 release:prepare 时 Maven 出现问题
【发布时间】:2013-08-06 14:00:57
【问题描述】:

我有一个使用多模块的 Maven 项目,当我执行命令 release:prepare 时,出现了一些问题:

[INFO] Working directory: C:\Java\workspace
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Unable to tag SCM
Provider message:
The svn tag command failed.
Command output:
svn: E160013: File not found: revision 1065, path '/trunk'

Pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <groupId>[hidden].logreport</groupId>
    <artifactId>logreport</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>pom</packaging>

    <modules>
        <module>../logreport-client</module>
        <module>../logreport-common</module>
        <module>../logreport-server</module>
    </modules>

    <properties>
        <encoding>UTF-8</encoding>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
        <!-- Timestamp format for the maven.build.timestamp property -->
        <!-- You can reference property in pom.xml or filtered resources (must 
            enable third-party plugin if using Maven < 2.1) -->
        <maven.build.timestamp.format>yyyyMMdd'T'HHmmss</maven.build.timestamp.format>
        <svn.username>[hidden]</svn.username>
        <svn.password>[hidden]</svn.password>
    </properties>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.11</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <distributionManagement>
        <repository>
            <id>[hidden]-releases</id>
            <url>http://[hidden]/nexus/content/repositories/my-releases/</url>
        </repository>
        <snapshotRepository>
            <id>[hidden]-snapshots</id>
            <url>http://[hidden]/nexus/content/repositories/my-snapshots</url>
        </snapshotRepository>
    </distributionManagement>

    <scm>
        <developerConnection>scm:svn:svn://[hidden]/svn/infra/trunk/logreport/</developerConnection>
        <connection>scm:svn:svn://[hidden]/svn/infra/trunk/logreport/</connection>
        <url>svn://[hidden]/svn/infra/trunk/logreport/</url>
    </scm>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>2.4.1</version>
                <configuration>
                    <releaseVersion>0.0.1</releaseVersion>
                    <developmentVersion>0.0.2-SNAPSHOT</developmentVersion>
                    <autoVersionSubmodules>true</autoVersionSubmodules>
                    <resume>false</resume>
                    <username>${svn.username}</username>
                    <password>${svn.password}</password>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>

如果我把标签 &lt;remoteTagging&gt;false&lt;/remoteTagging&gt; ,另一个问题:

[INFO] Working directory: C:\Java\workspace
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Unable to tag SCM
Provider message:
The svn tag command failed.
Command output:
svn: E155007: 'C:\Java\workspace' is not a working copy

我的项目位于“C:\Java\workspace\logreport”中。

Tks

【问题讨论】:

  • 这可能对 IME 没有帮助,如果您的项目有外部变量并且错误消息没有提供信息,则发布命令不起作用。你的项目中有 externs 吗?
  • 你能否展示完整的文件夹结构,你是如何调用 maven 的,以及你从哪里调用了 maven 的命令?

标签: java maven release maven-plugin maven-release-plugin


【解决方案1】:

通常,如果您有一个多模块构建,您应该具有以下结构:

  +-- parent (pom.xml)
       +-- module-1 (pom.xml)
       +-- module-2 (pom.xml)

这意味着父节点也位于 VCS 的主干中(在本例中为 SVN)。

此外,上述结构的结果是你的父母看起来像这样:

<modelVersion>4.0.0</modelVersion>

<groupId>com.company.logreport</groupId>
<artifactId>parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>

<modules>
    <module>logreport-client</module>
    <module>logreport-common</module>
    <module>logreport-server</module>
</modules>

而在父节点中只定义一次的scm信息如下:

<scm>
    <developerConnection>scm:svn:svn://[hidden]/svn/infra/trunk/</developerConnection>
    <connection>scm:svn:svn://[hidden]/svn/infra/trunk/</connection>
    <url>svn://[hidden]/svn/infra/trunk/</url>
</scm>

除此之外,您永远不应该在 pom.xml 中定义密码。这些东西的预定位置是settings.xml

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                      http://maven.apache.org/xsd/settings-1.0.0.xsd">
  ...
  <servers>
    <server>
      <id>svn-server</id>
      <username>my_login</username>
      <password>my_password</password>
    </server>
  </servers>
  ...
</settings>

【讨论】:

    猜你喜欢
    • 2018-05-19
    • 2020-10-31
    • 1970-01-01
    • 1970-01-01
    • 2011-03-28
    • 2020-10-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多