Skip to content

Maven wrapper broken with maven 4.0.0-beta-5 and above (solved issue included) #2520

Closed

Description

@hazendaz

Affected version

4.0.0-beta-5, 4.0.0-rc-1, 4.0.0-rc-2, 4.0.0-rc-3, 4.0.0-rc-4

Bug description

See apache/maven-wrapper#325 for further details and issue.

Maven 4.0.0-beta-5 and above changed to use selective MAVEN_MAIN_CLASS. Because maven wrapper very closely mimics mavens own mvn and mvn.cmd, any changes would need ported to the maven wrapper. However, to some degree that breaks backwards compatibility since its a maven 4 item only but would work by fixing wrapper as noted (probably more than I did). I think it would be better though to add the defaulting when missing inside maven itself rather than expect the script pass a defaulted value along so that there is no breaking maven wrapper.

This line

if "%MAVEN_MAIN_CLASS%"=="" @set MAVEN_MAIN_CLASS=org.apache.maven.cling.MavenCling

Can we do this inside maven itself when missing instead? That would immediately fix the maven wrapper issue. Since its the internals throwing errors, I suspect that answer is yes.

Activity

  1. added
    bug
    on Jun 26, 2025
  2. added this to the 4.0.0 milestone on Jul 2, 2025
  3. DidierLoiseau commented on Jul 7, 2025

    @DidierLoiseau
    Contributor

    This looks similar to the issue I was mentioning in #1750 (comment)

    To which @gnodet replied with:

    I suppose we could make it default to org.apache.maven.cling.MavenCling ...

  4. gnodet commented on Oct 10, 2025

    @gnodet
    Contributor

    This is currently out of control from Maven. Maven uses plexus classworlds to bootstrap the java JVM and it does not seem a good idea to make it dependant on Maven. I'm investigating replacing it, so this may be an opportunity to fix it, but not short term.

    The locations inside maven already default to org.apache.maven.cling.MavenCling, but unfortunately, none of them is in java, as they are in the shell scripts and in the m2.conf.

  5. modified the milestones: 4.0.0, 4.1.0 on Oct 10, 2025
  6. added a commit that references this issue on Aug 28, 2026
    a8be2cb
  7. added a commit that references this issue on Aug 28, 2026
    46b5e37
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

    bug

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions