Another option is creating an artifact of type ‘pom’ that consists of just a 
pom.xml with a <dependencyManagement> section and optionally properties for the 
versions (so they can easily be overridden when needed), and importing this BOM 
(bill of materials) artifact in your applications.

See spring-boot-dependencies for an example: 
https://search.maven.org/artifact/org.springframework.boot/spring-boot-dependencies/2.5.4/pom

You can use such an artifact as the parent of your applications (especially 
handy if you also want to centralize plugin configurations, etc.), or import 
its dependency management like this:

<dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>com.example</groupId>
      <artifactId>example-dependencies</artifactId>
      <version>1.0.0</version>
      <type>pom</type>
      <scope>import</scope>
    </dependency>
  </dependencies>
</dependencyManagement>
<dependencies>
  <dependency>
    <groupId>com.example</groupId>
    <artifactId>example-artifact</artifactId>
    <!-- Don’t provide a version here, that version is centrally managed in 
example-dependencies -->
  </dependemcy>
</dependencies>

See 
https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#bill-of-materials-bom-poms
 for more information about BOM POMs.

Nils.

> Op 2 sep. 2021, om 16:52 heeft Delany <delany.middle...@gmail.com> het 
> volgende geschreven:
> 
> Hi Bruno,
> 
> You can define a property in a project all projects inherit from
> 
> <properties>
>  <dep.cglib.cglib>3.2.4</dep.cglib.cglib>
> 
> Then add a dependencyManagement section that sections the version
> 
>  <dependencyManagement>
>    <dependencies>
>      <dependency>
>        <groupId>cglib</groupId>
>        <artifactId>cglib</artifactId>
>        <version>${dep.cglib.cglib}</version>
> 
> And use this plugin to check for updates etc
> https://www.mojohaus.org/versions-maven-plugin/
> 
> Delany
> 
> On Thu, 2 Sept 2021 at 16:40, Bruno <x.ma...@melloni.com> wrote:
> 
>> I have been developing in Java almost from the beginning, but have not
>> used Maven for much more than a few personal test apps. I am now about
>> to migrate nearly 100 applications to Maven and I am a bit concerned
>> about how to manage dependency versions across that many projects in the
>> future.
>> 
>> For a single app it is simple, go into the POM, modify the version of
>> the dependency, then verify that nothing broke due to newly unsupported
>> methods and fix the issues.
>> 
>> But if you have a lot of applications, the above method becomes very
>> time consuming and manual.
>> 
>> QUESTION:  Is there a best practice (or perhaps tools that help) for how
>> to handle updating the dependency versions for that many applications?
>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
>> For additional commands, e-mail: users-h...@maven.apache.org
>> 
>> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to