Closed skin27 closed 1 year ago
Hi,
I about 130 small projects.
A few years back I face the same problem.
What I did to write a program that collect all the dependencies and create aggregated POM and then run the org.apache.maven.shared.invoker.Invoker to do the job.
I use maven.version.rules = file:///K:/JavaAPPs/MyMaven/maven.version.rules.xml
<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">(?i).*(-alpha|.alpha|beta|-ea|-m1|-m2|-m3|-m4|cr|rc).*</ignoreVersion>
</ignoreVersions>
<rules>
<rule groupId="org.apache.maven.archetypes" artifactId="maven-archetype-quickstart" comparisonMethod="maven">
<ignoreVersions>
<ignoreVersion type="regex">(?i).*</ignoreVersion>
</ignoreVersions>
</rule>
<rule groupId="com.google.guava" comparisonMethod="maven">
<ignoreVersions>
<ignoreVersion type="regex">(?i).*(android).*</ignoreVersion>
</ignoreVersions>
</rule>
<rule groupId="org.openjfx" comparisonMethod="maven">
<ignoreVersions>
<ignoreVersion type="regex">(?i).*(20.0.1).*</ignoreVersion>
</ignoreVersions>
</rule>
</rules>
Another program use a list of dependencies to scan the projects and for each found run "versions:use-next-releases"
Regards.
p.s. I will be happy to share the code. please let me know.
That's interesting. But the question I still have, why does the default approach not work (the ignore rules and exclude parameters). Is it because submodules are used? Or is it something different?
I do not use submodules so I can't say. Have you tried my rules just to omit problems with regular expressions ?
I copied your rules. I had to change one so "-ea" will work.
<!-- <ignoreVersion type="regex">.*[-_\.](alpha|Alpha|ALPHA|b|beta|Beta|BETA|rc|RC|M|EA)[-_\.]?[0-9]*</ignoreVersion> -->
<ignoreVersion type="regex">(?i).*(alpha|Alpha|ALPHA|b|beta|Beta|BETA|rc|RC|M|EA).*</ignoreVersion>
I found out that (probably due to a misconfiguration) the rules.xml wasn't applied. So even when I made the XML file invalid it didn't give an error.
The configuration that worked for me was:
project pom.xml
<properties>
<maven.versions.rules>file:///${project.basedir}/rules.xml</maven.versions.rules>
<properties>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.15.0</version>
<configuration>
<rulesUri>${maven.versions.rules}</rulesUri>
</configuration>
</plugin>
</plugins>
</build>
pom.xml for every submodule
<properties>
<maven.versions.rules>file:///${project.basedir}/../rules.xml</maven.versions.rules>
</properties>
Thanks for your help
I have a multimodule Maven project that I like to keep up-to-date with the versions plugin. When running the plugin I like to ignore versions like alpha's and snapshot. I found several resources on StackOverflow and tried to following commands:
mvn -f ....\pom.xml versions:display-dependency-updates -Dexcludes=org.apache.camel: -DignoredVersions="1.0.1,.+-M.,.-SNAPSHOT" -DlogOutput=false
mvn -f ....\pom.xml versions:display-dependency-updates -DrulesUri="file:///${parent.basedir}/rules.xml"
The rulesset file:
The output is for example (both commands):
Additional information:
JDK Version JDK 11 (Eclipse Temurin 11.0.18) OS: Windows 10 Maven version: 3.8.6 Versions plugin: 2.15.0
What am I doing wrong? What's the correct way to ignore these versions?