At my workplace, different groups works on providing different services.
My team consumes these services. Currently, whenever a new version of Service is rolled out, we manually change the pom.xml to the latest version of dependency and then make a build. I am wondering if there is an automatic way of pulling latest release into build.
Here is an example to explain:
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">
        <groupId>com.company.product</groupId>
        <artifactId>User-Application</artifactId>
        <version>1.0.1-SNAPSHOT</version>
        <packaging>war</packaging>
<properties>
      <Service1-version>1.0.2</Service-1>
       <Service2-version>1.1.2</Service-2>
       <Service3-version>2.0.2</Service-3>
</properties>
    <dependencies>
            <dependency>
                <groupId>com.company.product</groupId>
                <artifactId>Service1</artifactId>
                <version>${Service1-version}</version>
            </dependency>
            <dependency>
                <groupId>com.company.product</groupId>
                <artifactId>Service2</artifactId>
                <version>${Service2-version}</version>
            </dependency>
            <dependency>
                <groupId>com.company.product</groupId>
                <artifactId>Service3</artifactId>
                <version>${Service3-version}</version>
            </dependency>
    .....
    ....
    </project>
When new release of each service is made, we manually change the pom.xml to get the latest dependency. How can this be managed automatically?
The versions-maven-plugin should be able to do this with the task versions:update-properties. See an example here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With