简体   繁体   中英

Performing maven release in multimodule project failing

I have a multimodule(module1,module2,module3) project which has an aggregator pom to build all the modules.

Now the reactor build order is

                     module1
                     module2
                     module3

Also module2 has dependency on module1 and module3 has dependency on module2,Now to account for the dependency I am using ${project.version} to specify the module1 version in module2 pom, similarly I am using ${project.version} in module 3 pom to refer to module2.Now the snapshot jobs are executed successfully but when i try to release all the modules using the aggregator pom(which is the parent pom for all the modules) the build fails saying that it cannot release project due to non released dependencies.Is there a way to solve this problem?

I am using Maven 3.0.4 maven-release-plugin:2.0-beta-8 for the project. Also it is necessary for module2 to use the latest version of module1 which is also true for module3 and module2.And it is necessary to release all of them together as I would want the modules to be released only when all of them are built successfuly.

parent pom

    <project>
    <groupid>com.mycompany</groupid>
    <artifactid>parent</artifactid>
    <version>1.0.0</version>
    <modules>
            <module>module1</module>
            <module>module2</module>
            <module>module3</module>
        </modules>






    ..


    </project>


    module1 pom

    <project>
    <parent>
    <groupid>com.mycompany</groupid>
    <artifactid>parent</artifactid>
    <version>1.0.0</version>
    <relativePath>../pom.xml</relativePath>
    </parent>

    <groupid>com.mycompany</groupid>
    <artifactid>module2</artifactid>




    <dependencies>
        ..
        ..

    </dependencies>


    module2 pom


    <project>
    <parent>
    <groupid>com.mycompany</groupid>
    <artifactid>parent</artifactid>
    <version>1.0.0</version>
    <relativePath>../pom.xml</relativePath>
    </parent>

    <groupid>com.mycompany</groupid>
    <artifactid>module2</artifactid>




    <dependencies>
        <dependency>
        <groupid>com.mycompany</groupid>
        <artifactid>module1</artifactid>
        <version>${project.version}</version>
        </dependency>
         ..
         ..
         ..
    </dependencies>

    ..


    </project>

Things to check

1) Make sure any dependencies under the same parent are specified with ${project.version}

2) Make sure each module does not explicitly declare it's own version but only specifies a parent, which in turn will set the version.

3) Make sure each project does not explicitly declare a groupId, that should come from the parent.

4) Make sure there are not SNAPSHOT dependencies. The only place that SNAPSHOT should occur in all modules is in the parent pom.

5) Make sure all your poms have a packaging declared, the parent should be pom.

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