Where placed the scm tag?

2019-08-09 10:11发布

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条回答
唯我独甜
2楼-- · 2019-08-09 11:02

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
查看更多
登录 后发表回答