0

We run multiple sites and build their code with Maven.

Each site has its own pom.xml, several have submodules.

Site B has a dependency on a submodule from site A.

Site B finds this dependency in the .m2/repository.

Currently, site B's pom.xml specifies the dependency name and version.

We're wondering how to handle versioning of submodules in terms of our development and release process, as well as in relation to a site that depends on a submodule from another like site B does to site A.

For the main site, should we increment the version of the submodules for every snapshot and release (keeping everything with the same version number), or only change submodule version if the submodule changes?

Is there some way, other than by communicating the new version, and editing the pom.xml of site B, updating the dependency version, to tell site B there is a new version of the submodule to look for?

We tried removing the version from the dependency specification in the site B pom.xml, but saw then that it looked for the dependency/submodule to have the same version as site B's code.

I'm guessing we could setup something in Jenkins to update pom.xml dependencies when versions change ... but maybe there is a better way?

I just saw this, which is very helpful (e.g. "release" and "latest") ...

How do I tell Maven to use the latest version of a dependency?

Community
  • 1
  • 1

1 Answers1

0

If you read the whole Q&A you linked, you'll see there can be a lot of issues with LATEST and RELEASE, the first of which is they are no longer supported in Maven 3. The answers given mention the versions-maven-plugin and maven-scm-plugin, those might be useful for automatic updates if that's what you want.

If you simply want to be aware when something changes, the versions plugin has reports you may run as part of the site phase to produce the info you want, you may then update the dependencies when the time is right.

<reporting>
    <plugins>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>versions-maven-plugin</artifactId>
            <version>1.3.1</version>
            <reportSets>
                <reportSet>
                    <reports>
                        <report>dependency-updates-report</report>
                        <report>plugin-updates-report</report>
                        <report>property-updates-report</report>
                    </reports>
                </reportSet>
            </reportSets>
        </plugin>
    </plugins>
</reporting>
messivanio
  • 2,263
  • 18
  • 24
user944849
  • 14,524
  • 2
  • 61
  • 83