Skip to content
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

Semantics issue in 2.15.0 with 6.2.5.Final #929

Closed
AndyThiel opened this issue Mar 6, 2023 · 5 comments · Fixed by #930
Closed

Semantics issue in 2.15.0 with 6.2.5.Final #929

AndyThiel opened this issue Mar 6, 2023 · 5 comments · Fixed by #930
Labels
Milestone

Comments

@AndyThiel
Copy link

There seems to be a regression in 2.15.0 where update-properties updates the hibernate-validator version from 6.2.5.Final to 8.0.0.Final, even with allowMajorUpdates set to false. With 2.14.2 this does not happen.

@jarmoniuk
Copy link
Contributor

jarmoniuk commented Mar 6, 2023

I could not reproduce the issue.

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>default-group</groupId>
    <artifactId>default-artifact</artifactId>
    <version>1.0.0</version>
    <packaging>pom</packaging>

    <properties>
        <artifact-version>6.2.5.Final</artifact-version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.hibernate.validator</groupId>
            <artifactId>hibernate-validator</artifactId>
            <version>${artifact-version}</version>
        </dependency>
    </dependencies>

</project>
mvn org.codehaus.mojo:versions-maven-plugin:2.15.0:update-properties -DallowMajorUpdates=false
[INFO] --- versions-maven-plugin:2.15.0:update-properties (default-cli) @ default-artifact ---
[INFO] Property ${artifact-version}: Leaving unchanged as 6.2.5.Final
[INFO] ------------------------------------------------------------------------

Please attach debug log (add -X to the command)

@AndyThiel
Copy link
Author

I'd have to find the time to create a minimal setup. The log I could create now would contain too much sensitive data. Not sure when I can find the time, thanks for checking.

@AndyThiel
Copy link
Author

Okay, stole some time ... and it changes the character of the report, but might still be a bug!?

pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>default-group</groupId>
    <artifactId>default-artifact</artifactId>
    <version>1.0.0</version>
    <packaging>pom</packaging>

    <properties>
        <artifact-version>6.2.5.Final</artifact-version>

        <versions-maven-plugin.version>2.15.0</versions-maven-plugin.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.hibernate.validator</groupId>
            <artifactId>hibernate-validator</artifactId>
            <version>${artifact-version}</version>
        </dependency>
    </dependencies>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>versions-maven-plugin</artifactId>
                    <version>${versions-maven-plugin.version}</version>
                    <configuration>
                        <rulesUri>[rulefile]</rulesUri>
                        <allowMajorUpdates>false</allowMajorUpdates>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

</project>

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|atlassian|b[0-9]+|beta|cr|dev|ea|jre[0-9]+|m[0-9]+|mistake|mr|rc).*
        </ignoreVersion>
    </ignoreVersions>
    <rules>
        <rule groupId="org.hibernate.validator" artifactId="*" comparisonMethod="numeric">
            <!-- Releases: https://hibernate.org/validator/releases/ -->
            <!-- Versioning Scheme: https://hibernate.org/community/compatibility-policy/#versioning-scheme -->
            <!-- Maven Central: https://search.maven.org/search?q=g:org.hibernate.validator -->
        </rule>
        <rule groupId="commons-betwixt" artifactId="commons-betwixt" comparisonMethod="maven">
            <!-- Ignore the earliest version (suggested as major version update) -->
            <ignoreVersions>
                <ignoreVersion>20030211.133854</ignoreVersion>
            </ignoreVersions>
        </rule>
    </rules>
</ruleset>

So there is an explicit rule for hibernate-validator ... and up to 2.14.2 there were no majorVersionUpdates suggested, but with 2.15.0 the update happens.

@jarmoniuk
Copy link
Contributor

Thanks, that's better. So, the crucial piece of information missing from the original report is the use of a ruleSet with comparisonMethod numeric.

It's very likely that #898 introduced this regression. Until this is fixed, you might want to consider using a different comparisonMethod to your rule (e.g. "maven"), or restrict the version of the versions plugin.

jarmoniuk added a commit to jarmoniuk/versions-maven-plugin that referenced this issue Mar 7, 2023
…s to produce the String representation of the version in their #toString method

Otherwise numeric comparison will not work properly. Amended BoundArtifactVersion
jarmoniuk added a commit to jarmoniuk/versions-maven-plugin that referenced this issue Mar 7, 2023
…ions to produce the String representation of the version in their #toString method

Otherwise numeric comparison will not work properly. Amended BoundArtifactVersion
@jarmoniuk
Copy link
Contributor

jarmoniuk commented Mar 7, 2023

The problem only occurs if one uses numeric with segment restrictions (major, minor, etc.), regardless of the goal; i.e., not just for property updates. Pretty broad scope, but, on the other hand, numeric is not widely used.

Hopefully the fix gets merged soon.

jarmoniuk added a commit to jarmoniuk/versions-maven-plugin that referenced this issue Mar 7, 2023
…ions to produce the String representation of the version in their #toString method

Otherwise numeric comparison will not work properly. Amended BoundArtifactVersion
jarmoniuk added a commit to jarmoniuk/versions-maven-plugin that referenced this issue Mar 7, 2023
…ions to produce the String representation of the version in their #toString method

Otherwise numeric comparison will not work properly. Amended BoundArtifactVersion
@slawekjaranowski slawekjaranowski added this to the next-release milestone Mar 14, 2023
slawekjaranowski pushed a commit that referenced this issue Mar 14, 2023
…produce the String representation of the version in their #toString method

Otherwise numeric comparison will not work properly. Amended BoundArtifactVersion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants