Is there any way to make maven look for new versions of dependencies?
for example, i have commons-lang commons-lang 2.3
version 2.4 could be out, I dont know. i'd rather not check is manually(by writting 2.4 in this case), because i have many dependencies. I think i saw some trick to make maven use latest version.
Removing Duplicate Dependencies Once we have identified our duplicate dependencies, the simplest way to remove them is to delete them from pom. xml and keep only those unique dependencies that are used by our project.
Dependency mediation Determines what version of a dependency is to be used when multiple versions of an artifact are encountered. If two dependency versions are at the same depth in the dependency tree, the first declared dependency will be used.
Multiple transitive dependencies can be excluded by using the <exclusion> tag for each of the dependency you want to exclude and placing all these exclusion tags inside the <exclusions> tag in pom. xml. You will need to mention the group id and artifact id of the dependency you wish to exclude in the exclusion tag.
Full name: org.apache.maven.plugins:maven-dependency-plugin:3.3.0:copy-dependencies. Description: Goal that copies the project dependencies from the repository to a defined location.
mvn versions:display-dependency-updates
Will show dependency updates
Read more here: display-dependency-updates
I think i saw some trick to make maven use latest version.
Yes, there are special version numbers to handle this:
When you depend on a plugin or a dependency, you can use the a version value of LATEST or RELEASE. LATEST refers to the latest released or snapshot version of a particular artifact, the most recently deployed artifact in a particular repository. RELEASE refers to the last non-snapshot release in the repository.
(Excerpt from Maven, the definitive guide)
PS: although the book also mentions this as a "not-so-best" practice...
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