【问题标题】:Maven release plugin - release:perform - wrong SVN structure is createdMaven 发布插件 - release:perform - 创建了错误的 SVN 结构
【发布时间】:2015-05-26 00:08:19
【问题描述】:

我有一个 maven 项目 + 2 个模块,我使用 maven 发布插件来发布新版本。

不幸的是目标

发布:执行

没用,虽然

发布:干净发布:准备

工作正常。

我已经发现了问题,但我不知道如何解决它。 这是我的 maven-release-plugin 配置:

...
<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>2.5.2</version>
                <configuration>
                    <tagBase>https://path_to_svn_server/ApplicationServer/tags/</tagBase>
                    <workingDirectory>${project.build.directory}/checkout/</workingDirectory>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>
</build>
...
<scm>
    <url>http://path_to_svn_server/ApplicationServer/trunk/</url>
    <developerConnection>scm:svn:https://path_to_svn_server/ApplicationServer/trunk/</developerConnection>
</scm>
...

问题:

release:prepare 在我的 SVN 存储库中创建以下结构:

+Branches
-Tags
  -commons-0.0.1
     +branches
     +tags
     -trunk
         commons
         commons.bom
         commons.service

release:perform 尝试从错误的签出目录加载,如您在 Maven 日志输出中所见:

--- maven-release-plugin:2.5.2:perform (default-cli) @ commons ---
[INFO] Checking out the project to perform the release ...

[INFO] Executing: cmd.exe /X /C "svn --non-interactive checkout
https://path_to_svn_server/ApplicationServer/tags/commons-0.0.8
path_to_workspace\ApplicationServer\trunk\commons\target\checkout"

[INFO] Working directory:
path_to_workspace\ApplicationServer\trunk\commons\target

[INFO] Executing goals 'deploy'...
[WARNING] Base directory is a file. Using base directory as POM location.

事实上,我磁盘上的“正确”路径如下所示:

path_to_workspace\ApplicationServer\trunk\commons\target\checkout\trunk\commons

出于测试目的,我将 commons 项目(包括模块)向上移动了一层,之后新的 svn 结构如下所示:

+Branches
-Tags
  -commons-0.0.1
     commons
     commons.bom
     commons.service

这个解决方法很好用!!版本已成功部署到我的 Archiva Repo。 (但这只是一种解决方法....)

我已经尝试过更改 tagBase 路径和 workingDirectory 路径,但不幸的是它仍然无法正常工作。

我的尝试之一:

<workingDirectory>${project.build.directory}/checkout/trunk 

结果是:

path_to_workspace\ApplicationServer\trunk\commons\target\checkout\trunk\trunk\commons

请你帮我解决这个问题? 我假设我必须修复 workingDirectory 路径?但是,为了解决它,正确的方法是什么? 非常感谢您!

编辑:

如果我没记错的话,由 release:prepare 创建的 SVN 结构并不是真的没问题... 通常 TAG 文件夹不再包含“分支”、“标签”、“主干”。

也许我必须修复标记库而不是工作目录? 但是如何修复SVN结构?是否有任何其他设置可以帮助我?

【问题讨论】:

    标签: svn maven-3 maven-release-plugin visualsvn-server


    【解决方案1】:

    我解决了“问题”。

    需要将项目名称附加到developerConnection,然后将创建以下SVN结构:

    +Branches
    -Tags
        -commons-0.0.1
             commons
             commons.bom
             commons.service
    

    而不是

    +Branches
    -Tags
        -commons-0.0.1
        +branches
        +tags
        -trunk
             commons
             commons.bom
             commons.service
    

    就我而言(多模块构建),我只需要将父项目添加到 developerConnection。

    这是我的配置:

    ...
    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-release-plugin</artifactId>
                    <version>2.5.2</version>
                    <configuration>
                        <tagBase>https://path_to_svn_server/ApplicationServer/tags/</tagBase>
                        <workingDirectory>${project.build.directory}/checkout/</workingDirectory>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
    ...
    <scm>
        <url>http://path_to_svn_server/ApplicationServer/trunk/</url>
        <developerConnection>scm:svn:https://path_to_svn_server/ApplicationServer/trunk/commons</developerConnection>
    </scm>
    ...
    
    <distributionManagement>
            <repository>
                <id>archiva.internal</id>
                <name>Internal Release Repository</name>
                <url>http://path_to_archiva_server/repository/internal</url>
            </repository>
    </distributionManagement>
    

    mvn 命令以启动整个过程:

    mvn release:clean release:prepare release:perform

    也许我可以帮助别人写我的帖子 :)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-11-27
      • 1970-01-01
      • 2013-09-06
      • 2012-11-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多