mavenversions-maven-pluginmaven-versions-plugin

Does the Maven Versions Plugin read rules also from classpath?


The Maven Versions Plugin supports the defintion of rules to customize the version resolution process for goals as versions:display-plugin-updates or versions:display-dependency-updates. The location of the rules file can be specified by the rulesUri and the functionality behind this is provided by Maven Wagon.

Therefore I would like to know if it is also supported to provide a rule set within a Jar? I would like to one rule set for multiple projects.


Solution

  • A patch by me has been released with version 2.5 of the Versions Maven Plugin

    Now it is possible to create a version rules file and to place it on the classpath.

    This example below shows how to reference a rules file called rules.xml which is provided in a jar on the classpath:

    <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>versions-maven-plugin</artifactId>
        <version>2.7</version>
        <executions>
            <execution>
                <id>default-cli</id>
                <configuration>
                    <rulesUri>classpath:///rules.xml</rulesUri>
                </configuration>
            </execution>
        </executions>
        <dependencies>
            <dependency>                                
                <groupId>your.organisation</groupId>
                <artifactId>rulesspec</artifactId>
                <version>1234</version>
            </dependency>
        </dependencies>
    </plugin>
    

    Please keep in mind that the provided URI must start with classpath://.