79498979

Date: 2025-03-10 19:30:54
Score: 0.5
Natty:
Report link

I found that flatten-maven-plugin was not needed, using maven version 3.9.3.
I am using Team City and can be using other plugins in single repo parent pom.xml that does the replacement in ${revision} out-of-the-box. Another question is if this also works when releasing the artifact, which I have not tested yet.

 Singlerepo Parent pom.xml

<?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>shb.rte</groupId>
    <artifactId>mygateway</artifactId>
    <version>${revision}</version>
    <packaging>pom</packaging> 

....
....
    <properties>
             <revision>3.0.2-SNAPSHOT</revision>
    </properties> 

    <dependencyManagement>
        <dependencies> 
            <dependency>
                <groupId>shb.rte.mygateway</groupId>
                <artifactId>my-message-service</artifactId>
                <version>${revision}</version>
            </dependency>
Project in singelrepo: my-secure-message-service

<?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>
    <parent>
        <groupId>shb.rte</groupId>
        <artifactId>mygateway</artifactId>
        <version>${revision}</version>
    </parent>   
        <artifactId>my-message-parent</artifactId>
    <groupId>shb.rte.mygateway</groupId>
    <packaging>pom</packaging>
 
        <modules>
         <module>my-message-contract</module>
         <module>my-message-service</module>
        </modules>

Submodule in my-message-service:

<?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>
    <parent>
        <groupId>shb.rte.mygateway</groupId>
        <artifactId>my-message-parent</artifactId>
        <version>${revision}</version>
    </parent>
    <artifactId>my-message-service</artifactId>
Reasons:
  • Blacklisted phrase (1): Another question
  • Long answer (-1):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Tom Vahlman