2

我有一个使用多模块的 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>

如果我把标签<remoteTagging>false</remoteTagging>,另一个问题:

[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

4

1 回答 1

3

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

  +-- 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>
于 2013-08-07T06:12:42.150 回答