A Project Object Model or POM is the fundamental unit of work in Maven. It contains the project configuration details used by Maven.
Some of the configuration that can be specified in the POM are the project dependencies, the plugins or goals that can be executed, the build profiles, and so on.
The minimum requirement for a POM are the following:
Maven Version Range in Dependencies:
Upgrading Maven dependencies manually has always been a tedious work, especially in projects with a lot of libraries releasing frequently.
Developers could specify version ranges within which the artifacts would’ve been upgraded without the need of a manual intervention.
Version requirements have the following syntax: ('x' represents version)
A parenthesis ( ( & ) ) means "open" (exclusive).
Maven2 has provided two special metaversion values to achieve the result: LATEST and RELEASE.
They’ve been deprecated and completely removed in Maven3 for the sake of reproducible builds.
Some of the configuration that can be specified in the POM are the project dependencies, the plugins or goals that can be executed, the build profiles, and so on.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgseMRRhTurIHXeop2mniDqGaLFTk-kI-nz-deh0fkh5gR8yzosLhjYkMymTv8VEEdyDw8EpKBJeGgQXM_11iGqKHNdWvYn-gqR-7cSp5HilOdxmO3GMjL7AWX3lMu49GQdnJJT-PanhgQ/s320/maven+pom.png)
- project root
- modelVersion - should be set to 4.0.0
- groupId - the id of the project's group.
- artifactId - the id of the artifact (project)
- version - the version of the artifact under the specified group
Here's an example:
- <project>
- <modelVersion>4.0.0</modelVersion>
- <groupId>com.mycompany.app</groupId>
- <artifactId>my-app</artifactId>
- <version>1</version>
- </project>
Upgrading Maven dependencies manually has always been a tedious work, especially in projects with a lot of libraries releasing frequently.
Developers could specify version ranges within which the artifacts would’ve been upgraded without the need of a manual intervention.
Version requirements have the following syntax: ('x' represents version)
- 1.0 -> "Soft" requirement on 1.0 (just a recommendation, if it matches all other ranges for the dependency)
- [1.0]: -> "Hard" requirement on 1.0
- (,1.0]: -> x <= 1.0
- [1.5,): -> x >= 1.5
- [1.2,1.3]: -> 1.2 <= x <= 1.3
- [1.0,2.0): -> 1.0 <= x < 2.0
- (,1.0],[1.2,): -> x <= 1.0 or x >= 1.2; multiple sets are comma-separated
- (,1.1),(1.1,): -> this excludes 1.1 (for example if it is known not to work in combination with this library)
A parenthesis ( ( & ) ) means "open" (exclusive).
Maven2 has provided two special metaversion values to achieve the result: LATEST and RELEASE.
They’ve been deprecated and completely removed in Maven3 for the sake of reproducible builds.
Note: When you release a software, you should always make sure that your project depends on specific versions to reduce the chances of your build or your project being affected by a software release not under your control.
0 comments:
Post a Comment