Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I cure "Can't release project due to non released dependencies" when releasing a child module?

I'm using Maven 3.1.1 and trying to use the Maven release plugin to release a child module of a multi-module project. The parent module was released and this child module is not in the parent's child module list. In my child module pom.xml file, I have

    <parent>
            <artifactId>subco</artifactId>
            <groupId>org.mainco.subco</groupId>
            <version>52.0.0-SNAPSHOT</version>
    </parent>
    <name>myproject</name>
    <url>http://maven.apache.org</url>

    <dependencyManagement>
            <dependencies>
                    <dependency>
                            <groupId>org.mainco.subco</groupId>
                            <artifactId>core</artifactId>
                            <version>${project.version}</version>
                    </dependency>
   </dependencyManagement>

    <dependencies>
            ...
            <dependency>
                    <groupId>org.mainco.subco</groupId>
                    <artifactId>core</artifactId>
            </dependency>

However, when I run the below

mvn -B -DdevelopmentVersion=52.0.1-SNAPSHOT -DreleaseVersion=52.0.0 -Dusername=***** -Dtag=myproject-52.0.0 -DskipTests -P prod -Dresume=false -DdryRun=true -DallowTimestampedSnapshots=true org.apache.maven.plugins:maven-release-plugin:2.4.2:prepare

I get the errors

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.4.2:prepare (default-cli) on project myproject: Can't release project due to non released dependencies :
[ERROR] org.mainco.subco:core:jar:52.0.0-SNAPSHOT:compile
...
[ERROR] org.mainco.subco:subco:pom:52.0.0-SNAPSHOT

I'm not able to change any properties in the parent pom.xml file … is there anything I can do in the child module to get the above command to run successfully? I like using "${project.version}" because I don't have to hard-code versions in my pom. Also note that I'm using "-DallowTimestampedSnapshots=true" which is getting ignored.

Edit:

Even adding a separate version element to the pom, like so

    <parent>
            <artifactId>subco</artifactId>
            <groupId>org.mainco.subco</groupId>
            <version>52.0.0</version>
    </parent>

    <name>myproject</name>
    <url>http://maven.apache.org</url>
    <version>52.0.0-SNAPSHOT</version>

results in the same errors as above.

like image 921
Dave Avatar asked Nov 12 '22 18:11

Dave


1 Answers

Since the child modules I depended on were the same version as the parent, I changed

${project.version}

to

${project.parent.version}

and using the version configuration in the edit, the errors went away.

like image 183
Dave Avatar answered Nov 15 '22 07:11

Dave