You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Ignore a specific version suffix in version updates
60
+
61
+
Let's suppose you wanted `org.apache.maven.doxia:doxia-core:` not to be updated to `2.0.0-M6` or `org.apache.maven:maven-core` to `4.0.0-alpha-5' or anything with a `-M` or `-alpha' in it. Upon first sight of the `dependencyExcludes` option, one might consider to use it to filter out anything with `2.*-M.*` or `*-alpha.*`.
62
+
63
+
Well, that would be wrong. `dependencyIncludes` and `dependencyExcludes` work only on *input* dependencies, that is, dependency versions that are already being used by your project. This means that it is likely that you will still see the dreaded `2.0.0-M6`-like version in the updates.
64
+
65
+
You can either use `ruleSet` or `ignoredVersions`. The former allows for a greater control where you can specify ignored version patterns per dependency whereas the latter is intended to be used from command line ans only offers simple version filters.
66
+
67
+
So, let's say we want to display dependency updates of this very plugin and while doing so, ignore all updates with an `-M` or `-alpha` at the end of the version string, simply use:
Copy file name to clipboardexpand all lines: versions-maven-plugin/src/site/markdown/faq.md
+30
Original file line number
Diff line number
Diff line change
@@ -64,3 +64,33 @@ manager.
64
64
65
65
In most cases, using a repository manager will solve these issues as the repository managers usually
66
66
rebuild the metadata files based on the artifacts that are present.
67
+
68
+
### Why is a dependency version not excluded by dependencyExcludes
69
+
70
+
`dependencyIncludes` and `dependencyExcludes` work on *input* dependencies and not on <u>output</u> dependencies. That will mean that even if you include a version string you don't want the given dependency to be updated to, that version might still get chosen as the target dependency version.
71
+
72
+
The reason for that is that the option filters *input* dependency versions.
73
+
74
+
Let's suppose you wanted `org.apache.maven.doxia:doxia-core:` not to be updated to `2.0.0-M6` or `org.apache.maven:maven-core` to `4.0.0-alpha-5' or anything with a `-M` or `-alpha' in it. Upon first sight of the `dependencyExcludes` option, one might consider to use it to filter out anything with `2.*-M.*` or `*-alpha.*`.
75
+
76
+
Well, that would be wrong. `dependencyIncludes` and `dependencyExcludes` work only on *input* dependencies, that is, dependency versions that are already being used by your project. This means that it is likely that you will still see the dreaded `2.0.0-M6`-like version in the updates.
77
+
78
+
Instead, what you should be looking at is `ruleSet` or `ignoredVersions`. The former allows for a greater control where you can specify ignored version patterns per dependency whereas the latter is intended to be used from command line ans only offers simple version filters.
79
+
80
+
So, to ignore all updates with an `-M.*` at the end of the version string, simply use:
81
+
82
+
`-Dmaven.version.ignore=.*-M.*`
83
+
84
+
or:
85
+
86
+
```xml
87
+
<configuration>
88
+
...
89
+
<ignoredVersions>.*-M.*</ignoredVersions>
90
+
...
91
+
</configuration>
92
+
```
93
+
94
+
in your project config.
95
+
96
+
See [Issue #258](https://github.com/mojohaus/versions/issues/258) and [the documentation for ignoredVersions](https://www.mojohaus.org/versions/versions-maven-plugin/display-dependency-updates-mojo.html#ignoredVersions)
0 commit comments