简体   繁体   中英

Something is wrong with Maven when I execute the command release:prepare

I've a Maven project using multi-module, when I execute the command release:prepare, happens some problem:

[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>

If I put th tag <remoteTagging>false</remoteTagging> , another problem:

[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

My project is in 'C:\\Java\\workspace\\logreport'.

Tks

Usually if you have a multi-module build you should have the following structure:

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

which means also having the parent being located in the trunk of your VCS (in this case SVN).

Furthermore the result of the above structure is that your parent looks similar like this:

<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>

and the scm information which will be defined in the parent only once like this:

<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>

Apart from that you should never define passwords in your pom. The intended place for such things is the 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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM