Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

maven - Can't release project due to non released dependencies

I am using a multi-module pom setup and when using the release plugin I am unable to do so. I get the error:

Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5:prepare (default-cli) on project libraryparent: Can't release project due to non released dependencies :
com.xyz:libraryparent:pom:1.1-SNAPSHOT
in project 'utils' (com.xyz:utils:jar:1.1-SNAPSHOT)

the command I runs is:

mvn -B release:clean release:prepare release:perform -DdryRun=true -DdevelopmentVersion=1.2-SNAPSHOT -DreleaseVersion=1.1

Here is the major portions of the files that I think is relevant:

libraryparent

<modelVersion>4.0.0</modelVersion>
  <groupId>com.xyz</groupId>
  <artifactId>libraryparent</artifactId>
  <version>1.1-SNAPSHOT</version>
  <packaging>pom</packaging>

  <name>parent library</name>
  <description>A parent pom for all library modules</description>

    <modules>
        <module>../util</module>
        <module>../streams</module>
    </modules>

  <plugin>
        <artifactId>maven-release-plugin</artifactId>
        <version>2.5</version>
        <configuration>
            <releaseProfiles>release</releaseProfiles>
            <goals>deploy assembly:single</goals>
            <!--
            <autoVersionSubmodules>true</autoVersionSubmodules>
            -->
        </configuration>
    </plugin>

util

<project .....>
    <modelVersion>4.0.0</modelVersion>
    <artifactId>util</artifactId>
    <packaging>jar</packaging>

    <parent>
        <groupId>com.xyz</groupId> 
        <artifactId>libraryparent</artifactId> 
        <relativePath>../libraryparent/pom.xml</relativePath>
        <version>1.1-SNAPSHOT</version> 
    </parent>
</project>

streams

<project .....>

    <modelVersion>4.0.0</modelVersion>
    <artifactId>streams</artifactId>
    <packaging>jar</packaging>

    <parent>
        <groupId>com.xyz</groupId>
        <artifactId>libraryparent</artifactId> 
        <relativePath>../libraryparent/pom.xml</relativePath>
        <version>1.1-SNAPSHOT</version>
    </parent>

    <dependencies>

        <dependency>
            <groupId>com.xyz</groupId>
            <artifactId>util</artifactId>
            <version>1.1-SNAPSHOT</version>
            <!--
            <version>${project.parent.version}</version>
            -->
            <classifier>j2me</classifier>
            <optional>true</optional>
        </dependency>

    </dependencies>

</project>

I would suspect that the release plugin can set the versions to their release versions,etc.

Thanks.

like image 672
Wayne Avatar asked Oct 20 '22 03:10

Wayne


1 Answers

The maven-release-plugin verifies if the parent and dependencies are part of the multimodule project. If it's not recognized it's either because of a different version or because of a typo in the groupId and/or artifactId. com.xyz is probably fake, so please check that value again. Some may say that flat-projects (like this one) are not supported by the maven-release-plugin. However, there are a lot of integration-tests which do confirm that flat projects are supported.

like image 105
Robert Scholte Avatar answered Oct 23 '22 10:10

Robert Scholte