Tuesday 9 July 2019

Maven: Specify dependency version ranges


You can specify the version ranges while defining the dependencies in pom.xml file.

For example, you can specify, your project depends on log4j version between 1.1 to 1.3.

You can specify the version ranges between below characters.

(,) : Exclusive Quantifier
[,] : Inclusive Quantifier

(3, 8) : Version should be greater than 3 and less than 8.
(3, 8] : Version should be greater than 3 and less than or equal to 8.
[3, 8) : Version should be greater than or equal to 3 and less than 8.
[3, 8] : Version should be greater than or equal to 3 and less than or equal to 8.
[3, ]  : Version should be anything greater than or equal to 3
[, 8]  : Version should be anything less than or equal to 8

Example
<!-- https://mvnrepository.com/artifact/log4j/log4j -->
<dependency>
    <groupId>log4j</groupId>
    <artifactId>log4j</artifactId>
    <version>[1.1, 1.3]</version>
</dependency>



Previous                                                    Next                                                    Home

No comments:

Post a Comment