GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [MPLUGIN-522] The auto prerequisites are way too aggressive · Issue #825 · apache/maven-plugin-tools

[MPLUGIN-522] The auto prerequisites are way too aggressive #825

New issue
Copy link
New issue
Copy link
Open
Open
[MPLUGIN-522] The auto prerequisites are way too aggressive#825
Copy link
Labels
bugSomething isn't working

Description

@jira-importer
jira-importer
opened on May 6, 2024
Issue body actions

Tamas Cservenak opened MPLUGIN-522 and commented

IMHO the implementation done in MPLUGIN-425 and MPLUGIN-424 are wrong.

They are way too aggresive and violate backward compatibility: if new feature is not explicitly set by user, code should not "come up" with some automatic value. By having the value not set simply means user does not want to use it.

This is especially true for (maven or java) prerequisite, as it creates HARD BREAKAGE if not met. Use of prerequisite is opt-in, but now it is FORCED onto user.

Konrad Windszus 


Issue Links:

  • MPLUGIN-523 Split Maven3 and Maven4 support
    ("is blocked by")
  • MNG-7566 Allow a Maven plugin to require a Java version through its plugin descriptor
    ("is caused by")
  • MPLUGIN-425 Plugin descriptor should contain the requiredJavaVersion/requiredMavenVersion
    ("is caused by")

Remote Links:

  • GitHub Pull Request #282
Reacted by Erik Anderson

Activity

  1. jira-importer commented on May 6, 2024

    @jira-importer
    jira-importer
    on May 6, 2024
    Author
    More actions

    Tamas Cservenak commented

    Example: try with Maven4 + Java 21: mvn eu.maveniverse.maven.plugins:toolbox:tree and it will explode, claiming "plugin requires Java 22". Now use Java 11 and Maven 3.6.3, and plugin works!

  2. jira-importer commented on May 6, 2024

    @jira-importer
    jira-importer
    on May 6, 2024
    Author
    More actions

    Tamas Cservenak commented

    IMHO, any prerequisite should be added ONLY if explicitly specified. The two issues altered (in a wrong way) behaviour of m-p-p: they are ALWAYS added, and worse, the "auto" values are magically (and completely wrongly) calculated: if I compile against 3.9.6 Maven APIs, that – due backward compatibility – does NOT mean plugin "has a prerequisite of 3.9.6". As we all know, they are happily working even with 3.6.3 or even 3.2.x.

    Similarly, if I have one class that is Java 22, the plugin prerequisite is NOT Java 22.

    Both things should be reverted to original behaviour: added IF user specified them, otherwise omitted (instead of "auto calculate" them).

  3. jira-importer commented on May 7, 2024

    @jira-importer
    jira-importer
    on May 7, 2024
    Author
    More actions

    Tamas Cservenak commented

    For example the java prerequisite: why it gets "highest class version present on classpath"? Why not compiler target instead?

    For Maven prerequisite: you cannot infer Maven prerequisite based on API you compile against. As mentioned, even if I compile against latest (3.9.6), the plugin may just fine work with 3.6.3 as well.

    Hence, these two should be and remain (as before) opt in values. We cannot "deduce" what user wants, it is up to user to tell us what he wants.

  4. jira-importer commented on May 7, 2024

    @jira-importer
    jira-importer
    on May 7, 2024
    Author
    More actions

    Konrad Windszus commented

    why it gets "highest class version present on classpath"? Why not compiler target instead? ...

    Because in general it is fair to assume that every class being embedded in the plugin is supposed to be executed. That requires a Java version capable of digesting the class version. Not every class being shipped with the plugin is necessarily compiled in the same build.

    Similarly, if I have one class that is Java 22, the plugin prerequisite is NOT Java 22.

    It the class is in the plugin classpath I would assume that this is necessary for plugin execution (not necessarily for each mojo). If the class isn't being called then it shouldn't be there in the first place...

    if I compile against 3.9.6 Maven APIs, that – due backward compatibility – does NOT mean plugin "has a prerequisite of 3.9.6". As we all know, they are happily working even with 3.6.3 or even 3.2.x.

    What you describe is not backwards-compatibility but forwards-compatibility. Each minor Maven version may add new methods/classes to Maven API in a backwards-compatible way. Therefore it is fair to assume that the Maven API you compile against is the minimally required Maven version.

    What you are running into are edge cases which IMHO justify that you override the automatically created values (i.e. one class with bytecode for Java22 not being executed by the Mojo for some reason, compiling against a newer Maven version than you require). I don't want plugins to not state prerequisites at all just because plugin developers are too lazy, because that is very frustrating for users not complying with those (unexplicit) prerequisites.

  5. jira-importer commented on May 7, 2024

    @jira-importer
    jira-importer
    on May 7, 2024
    Author
    More actions

    Tamas Cservenak commented

    In that case just fail the build (like we did with prefix). You cannot auto deduce developer intent, as example shows, it happens in a wrong way.

  6. jira-importer commented on May 7, 2024

    @jira-importer
    jira-importer
    on May 7, 2024
    Author
    More actions

    Tamas Cservenak commented

    Currently m-p-p produces plugins:

    • that happily works on Java 11 w/ Maven 3.6.3
    • but fails with Maven 4 (that observe these new entries in plugin descriptor) due fals prerequisites: it claims it needs Java 22 and Maven 3.9.6, and none of these are true

    I, as a developer was totally oblivious of these auto-set values, until i tried the plugin with Maven4.

  7. jira-importer commented on May 7, 2024

    @jira-importer
    jira-importer
    on May 7, 2024
    Author
    More actions

    Tamas Cservenak commented

    Also, your statement is wrong: toolbox plugin does NOT have Java 22 class "in plugin". It has it in among dependencies, not the same (and is not even user-controlled).

  8. jira-importer commented on Aug 1, 2024

    @jira-importer
    jira-importer
    on Aug 1, 2024
    Author
    More actions

    Michael Osipov commented

    Tamas Cservenak, do you want to pick this up for 3.14.0 mid of August?

  9. jira-importer
    added
    bugSomething isn't working
    priority:majorMajor loss of function
    on Jun 19, 2025
  10. robtimus commented on Dec 17, 2025

    @robtimus
    robtimus
    on Dec 17, 2025
    More actions

    Maven 3.9.12 was released recently that also checks the required Maven and Java versions in plugin descriptors. One of the plugins I wrote was compiled using Java 8, but due to a transitive dependency* contains Java 16 in the plugin descriptor. It has worked just fine with Java 8 and 11, but because of this incorrect automatic recognition I now have to release a patch. Fortunately it's as easy as setting the requiredJavaVersion explicitly, but it's still annoying that all projects that use the plugin cannot build with Maven 3.9.12.

    * I'm guessing, the direct dependencies contain no Java 16 classes.

  11. slawekjaranowski commented on Dec 18, 2025

    @slawekjaranowski
    slawekjaranowski
    on Dec 18, 2025
    Member
    More actions

    If plugin contains transitive dependency with Java 16 how will be works when code from such dependencies will be used?

  12. robtimus commented on Dec 18, 2025

    @robtimus
    robtimus
    on Dec 18, 2025
    More actions

    The dependencies all work with Java 8, but that's the only reason why Maven would recognize 16 as required Java version and not 8.

  13. smaarn commented on Feb 24, 2026

    @smaarn
    smaarn
    on Feb 24, 2026
    More actions

    If plugin contains transitive dependency with Java 16 how will be works when code from such dependencies will be used?

    I believe there could be provided dependencies pulled by the maven dependencies ?

  14. slachiewicz
    removed
    priority:majorMajor loss of function
    on Sep 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.