-
Notifications
You must be signed in to change notification settings - Fork 267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Option to ignore plugin versions in pom.xml without need for Rules.xml #684
Comments
Sorry, I believe I misunderstood you in the beginning. The other ticket implemented a presentation filter of the listed dependency updates. What I'm going to do now is create an alternative for providing a ruleset in the rules.xml file, via -D properties or configuration entries in the pom. This will be available (almost) universally. |
I'm starting think, that we implements the same things in duple place ... I would do an exercise - add parameters with type When |
Excellent idea. Will be slightly more difficult to unit test (unless I create a Builder). |
First of all, sorry for the initial grumpy response earlier. I woke up expecting this to finally work and was hit with bad news in my inbox first thing in the morning. 😬 I think there will be less misunderstanding if we first clarify the use case before compiling a long list of features. Use case: we want all of our applications, simply by inheriting from a common parent POM, with no further configuration, to be able to check, using a single command, whether any of their dependencies or plugins have a later release version (i.e. not release candidate, not milestone, etc.) available. Also see my Versions Maven Plugin rules that are inheritable question on Stack Overflow.
That's what I thought this #258 was for! 😅 If the original |
And I want to clarify one thing: if the dependency Does that make sense? Perhaps that was already understood, but I wanted to mention it since there seems to have been a bit of confusion on some points. |
No worries. 😅
Yes, that's what I'm working on right now, more or less. By the way, I think you could probably be able to generate the rules.xml file with the resource plugin and then use the existing option with the version plugin to feed the file to it. I'm gonna try it out myself just to check the idea. |
@garretwilson here's an example of how you can do that: Provided you have a directory called <ruleset comparisonMethod="maven"
xmlns="http://mojo.codehaus.org/versions-maven-plugin/rule/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://mojo.codehaus.org/versions-maven-plugin/rule/2.0.0
https://www.mojohaus.org/versions-maven-plugin/xsd/rule-2.0.0.xsd">
<ignoreVersions>
<ignoreVersion type="regex">${ignoredVersions}</ignoreVersion>
</ignoreVersions>
</ruleset> Then, in your main project, create the following profile: <profile>
<id>rules-test</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<resources>
<resource>
<directory>rules-test</directory>
<filtering>true</filtering>
</resource>
</resources>
<outputDirectory>${project.basedir}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.12.0</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>display-dependency-updates</goal>
</goals>
<configuration>
<rulesUri>file://${project.basedir}/compiled-rules.xml</rulesUri>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile> If you then execute the following Maven target: mvn -P rules-test "-DignoredVersions=.*-(M\d*|.*-SNAPSHOT)" clean validate then you will get a dependencies report using the filter in the -DignoredVersiosn argument (filtering out both |
I am really not understanding why we simply can't put the rules in the POM (like they should have been in the first place) instead of in an external |
☝️ supporting the
It is my understanding that #602 supports only the |
This seems to be working fine so far, passing the rulesets in the pom.xml: <plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<goals>
<goal>display-dependency-updates</goal>
</goals>
<configuration>
<ruleSet>
<ignoreVersions>
<ignoreVersion>
<type>regex</type>
<version>.+-SNAPSHOT</version>
</ignoreVersion>
<ignoreVersion>
<type>regex</type>
<version>.+-M\d+</version>
</ignoreVersion>
<ignoreVersion>
<version>1.0.0</version>
</ignoreVersion>
</ignoreVersions>
</ruleSet>
</configuration>
</plugin> Not so easy with the
Not really; I was also confused. However, the goal here is to implement filtering on versions to consider for updates whereas that previous ticket (that is, what's already been implemented) is only a presentation filter -- intended to reduce clutter if one's only interested in a select set of dependencies. This update will however be quite broad as rules support is in almost every mojo of this plugin, and we only need to allow passing them via another means. |
For the command line parameter, should we use regexes or wildcards? What would you guys prefer? |
Command-line parameter? This simple request keeps getting made more complicated. If you want to create some extra command-line parameter, which wasn't even part of the original request, I think it should go into a separate ticket so as not to confuse things. |
To be sure that I understand correctly: this
Not sure I'd use this feature, but in general I favour regexes in non-performance critical code (such as this plugin), since they're more expressive than wildcards. |
Thanks for the input, I appreciate it. |
The bulk of work here is going to be committed on test coverage, since the enhancement will be present in almost all mojos. The workload with the implementation of the feature itself is not that large. So far, display-plugin-updates, display-property-updates, display-dependency-updates appear to work fine. Still working on coverage... |
Implemented, hopefully it gets merged into the next release. |
#258 requested the ability to allow
<ignoreVersions>
or its equivalent to be specified in the POM, like most other plugins, rather than in some separate, external rules file which is not inherited by the POM. #258 implemented a new exclusion system in the POM, but the implementation did not apply to thedisplay-plugin-updates
goal; this ticket is to add that functionality.The text was updated successfully, but these errors were encountered: