javamavenmaven-release-plugin

Ignore ${project.version} in Maven release:prepare


We have projects that are built one after another in the build server. They probably could become a multi-module project in the future, but at the moment there is no capacity for restructuring the repositories, projects etc. and introducing new parent POMs.

We tried to use a structure like

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

  <modelVersion>4.0.0</modelVersion>

  <groupId>de.something</groupId>
  <artifactId>project1</artifactId>
  <version>9.0.2-SNAPSHOT</version>

  <dependencies>
    <dependency>
      <groupId>de.something</groupId>
      <artifactId>project2</artifactId>
      <version>${project.version}</version>
    </dependency>

  </dependencies>

</project>

Unfortunately, the maven release plugin (more specifically, the release:prepare goal) fails on this because it considers the dependency to be a SNAPSHOT dependency.

Is there any way (besides rebuilding everything as multi-module) to tell the maven release plugin that this is not the case?

Something like


Solution

  • The "solution" is as follows: