Where placed the scm tag?

落花浮王杯 提交于 2019-12-11 05:46:26

问题


I have a little probleme with the scm tag in my pom.xml file.

My project architecture is like this:

Parent
Submodule1
Submodule2
reactor

Parent is the project which hold all maven plugins configuration, librairies version ect. It's the parent of reactor project which is the parent of all submodules.

Reactor is a pom.xml which contains tags to compile all submodules.

I would like put the scm tag on the parent pom.xml because it's the higher pom.xml. But I get an error when I want to do a "mvn release:prepare".

So I put the scm tag in the reactor pom.xml and it works.

It's good for me, it works :) but I don't understand why I need to put the scm tag in the reactor pom.

Someone can explain me this behavior ?

Thanks.

Edit:

Here is the folder structure:

root
  parent
    pom.xml (parent)
  submodule1
    pom.xml
  submodule2
    pom.xml
  pom.xml (reactor)

Here is the interesting part of pom reactor:

<parent>
    <groupId>groupId</groupId>
    <artifactId>parent</artifactId>
    <relativePath>./parent/pom.xml</relativePath>
    <version>1.0.2-SNAPSHOT</version>
</parent>

<modules>
    <module>parent</module>
    <module>submodule1</module>
        <module>submodule2</module>
</modules>

Finally, here is the error for the release:prepare:

[INFO] Unable to tag SCM Provider message: The svn tag command failed. Command output: svn: Path 'http://10.211.55.4/svn/trunk/reactor' does not exist in revision 112


回答1:


First requirement is that trunk, tags and branches folder in SVN exist which i assuem but you have to define the scm part only in the reactor and not in the parent.

  root
    +-- pom.xml (reactor)
    +-- parent
    !      +-- pom.xml (parent)
    +-- submodule1
    !      +-- pom.xml
    +-- submodule2
           +-- pom.xml

Furthermore you should define the maven-release-plugin (reactor) as well with true.

The default handling of such situation is that Maven will do relative changing of the SVN paths. This will produces trouble like you have. So you have to put the information into the reactor pom NOT into the parent pom. Very important is to have only a single configuration.

Furthermore i would recommend to remove the parent and put the information into the reactor, cause you would get trouble during site generation phase.

  root
    +-- pom.xml (parent)
    +-- submodule1
    !      +-- pom.xml
    +-- submodule2
           +-- pom.xml


来源:https://stackoverflow.com/questions/6402150/where-placed-the-scm-tag

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!