I'm trying to release individual modules of a multi-module project, contained within a single git repository.
The folder structure looks something like this:
|- api/pom.xml
|- database/pom.xml
|- core/pom.xml
pom.xml
The parent pom is simply used as a way of building all subcomponents in a way that makes sense by the use of the <modules>
tag. In essence, building api, then database, then core.
The project started out hosted in SVN and by simply pointing to different paths in the repository in the maven scm
tag it was easy to get the maven release
commands to play nice. This doesn't seem to be the case with Git.
When running mvn release:prepare
it performs changes on the api pom as desired, but when performing mvn release:perform
it attempts to build the parent pom, and fails to build the database package due to it's inability to resolve the api-snapshot dependency that is listed in database/pom.xml.
How should I configure my scm tags to be able to release a specific module within the Git repository? Is this even possible?
Edit: adding pom samples
Here's an example setup of how the pom files look:
parent pom.xml
<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>com.findwise.hydra</groupId>
<artifactId>hydra-parent</artifactId>
<version>0.2.0</version>
<packaging>pom</packaging>
<modules>
<module>api</module>
<module>database</module>
<module>core</module>
</modules>
</project>
api/pom.xml
<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>com.findwise.hydra</groupId>
<artifactId>hydra-api</artifactId>
<packaging>jar</packaging>
<version>0.2.0</version>
<name>${project.artifactId}</name>
<description>Hydra API</description>
<licenses>
...
</licenses>
<scm>
...
</scm>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
...
</dependencies>
<build>
<finalName>${project.name}</finalName>
<plugins>
...
</plugins>
</build>
</project>
The database
pom looks very much like api
, but has a dependency to api
. The same goes for core
, which depends on database
(and through it, on api
).
The api
and database
artifacts themselves are important on their own though, as api
defines the client API and database
the backend API, both of which are used for integrating with the application. From this stems the original thought of releasing them separately -- the parent pom is merely an afterthought to allow simpler building of the entire stack.