I have already two questions out there on updating Maven project version. Now I have an issue with updating the dependency version of dependant sibling projects.
My simplified project setup is following:
root
|--parent
|--tool-core
|--tool
|--functional-tests
The parent project holds all the global properties and dependency management. The functional tests depend on the tool and the tool depends on the tool-core. The root pom.xml only aggregates (specifies whether the functional tests are included) and the parent project is the parent for all of the projects. I don't know if this is trivial but the parent is not included in the aggregation though, as it already is parent for each child project.
Now, my problem is if I change the version of tool with versions:set
. The tool version is changed but any dependency to the tool is not. How should I do this? I have already tried more or less randomly other goals and I did try to read the manual.
I've tried already using the <dependencyManagement>
section and using a property for the version in the parent but these do not get updated to the new version.
Any help is really appreciated.
Addition
I get a message "Ignoring reactor dependency: com.tool:tool:jar:null:1.2.3" at best. This is when I try to versions:use-latest-releases
. However, versions:display-dependency-updates
does show that there is an update on a "local dependency" (functional-tests depend on tool).
Update
It seems that the Maven looks up for new versions from the repositories, including the local one which seems quite obvious now that I think of it. However, this means that the tool has to be built and installed to local repo before updating the dependencies.
I'm only wondering if this is the right way to have integration tests as their own project. I was hoping that there would be a way to update the version straight away.
Update
Basically I have the following setup. The version dependency on functional-tests
of the tool
is defined by the parent
project. I have omitted the tool-core
since it can be handled as part of the tool
.
root:
<groupId>com.somecompany</groupId>
<artifactId>x-reactor</artifactId>
<packaging>pom</packaging>
<version>1.0</version>
<profiles>
<profile>
<id>cli</id>
<modules>
<module>tool</module>
</modules>
</profile>
<profile>
<id>deploy</id>
<modules>
<module>tool</module>
<module>functional-tests</module>
</modules>
</profile>
</profiles>
parent:
<groupId>com.somecompany</groupId>
<artifactId>x-parent</artifactId>
<packaging>pom</packaging>
<version>1.0</version>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.somecompany</groupId>
<artifactId>tool</artifactId>
<version>3.2.3</version>
</dependency>
</dependencies>
</dependencyManagement>
tool:
<parent>
<groupId>com.somecompany</groupId>
<artifactId>x-parent</artifactId>
<version>1.0</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
<groupId>com.somecompany</groupId>
<artifactId>tool</artifactId>
<packaging>jar</packaging>
<version>3.2.3</version>
functional-tests:
<parent>
<groupId>com.somecompany</groupId>
<artifactId>x-parent</artifactId>
<version>1.0</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
<groupId>functional-tests</groupId>
<artifactId>functional-tests</artifactId>
<version>0.1</version>
<packaging>pom</packaging>
<dependencies>
<dependency>
<groupId>com.somecompany</groupId>
<artifactId>tool</artifactId>
</dependency>
</dependencies>