Uploaded image for project: 'Maven'
  1. Maven
  2. MNG-5607

Don't use M2_HOME in mvn shell/command scripts anymore

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 3.2.1
    • Fix Version/s: 3.5.0-alpha-1, 3.5.0
    • Component/s: Command Line
    • Labels:
      None
    • Environment:
      all

      Description

      Currently the mvn shell script and the mvn.bat using M2_HOME. This should be changed either to MAVEN_HOME or M3_HOME

        Issue Links

          Activity

          Hide
          afloom Anders Hammar added a comment -

          I don't think we should do this for Maven 3.x, but maybe for Maven 4?

          Show
          afloom Anders Hammar added a comment - I don't think we should do this for Maven 3.x, but maybe for Maven 4?
          Hide
          michael-o Michael Osipov added a comment -

          Karl Heinz, there was already a similar issue: MNG-5533. Even if this will be changes, this has to be MVN_HOME because the command name is mvn. Source code has to be adapted accordingly.

          Show
          michael-o Michael Osipov added a comment - Karl Heinz, there was already a similar issue: MNG-5533 . Even if this will be changes, this has to be MVN_HOME because the command name is mvn . Source code has to be adapted accordingly.
          Hide
          schulte77 Christian Schulte added a comment -

          +1 for MVN_HOME

          Show
          schulte77 Christian Schulte added a comment - +1 for MVN_HOME
          Hide
          schulte77 Christian Schulte added a comment -

          Command name is 'java' so environment variable should be 'JAVA_HOME' for consistency. Tending to close MNG-5606 'won't fix'.

          Show
          schulte77 Christian Schulte added a comment - Command name is 'java' so environment variable should be 'JAVA_HOME' for consistency. Tending to close MNG-5606 'won't fix'.
          Hide
          dantran Dan Tran added a comment -

          even better if not using any var. the script already self discover its install directory

          Show
          dantran Dan Tran added a comment - even better if not using any var. the script already self discover its install directory
          Hide
          hudson Hudson added a comment -

          SUCCESS: Integrated in maven-3.x #1203 (See https://builds.apache.org/job/maven-3.x/1203/)
          MNG-5607 Don't use M2_HOME anymore in mvn shell/batch file anymore (schulte: rev 364df32335a9c36986418498f654bf744d466767)

          • apache-maven/src/bin/mvn
          • apache-maven/src/bin/mvnDebug
          • apache-maven/src/bin/mvnyjp
          • apache-maven/src/bin/mvn.cmd
          Show
          hudson Hudson added a comment - SUCCESS: Integrated in maven-3.x #1203 (See https://builds.apache.org/job/maven-3.x/1203/ ) MNG-5607 Don't use M2_HOME anymore in mvn shell/batch file anymore (schulte: rev 364df32335a9c36986418498f654bf744d466767) apache-maven/src/bin/mvn apache-maven/src/bin/mvnDebug apache-maven/src/bin/mvnyjp apache-maven/src/bin/mvn.cmd
          Hide
          hudson Hudson added a comment -

          SUCCESS: Integrated in maven-3.x #1204 (See https://builds.apache.org/job/maven-3.x/1204/)
          MNG-5607 Don't use M2_HOME anymore in mvn shell/batch file anymore (schulte: rev d3b4fb0c1e525bb1122c7e832279f1ef6fbd6efe)

          • apache-maven/src/bin/mvn.cmd
          • apache-maven/src/bin/mvn
          Show
          hudson Hudson added a comment - SUCCESS: Integrated in maven-3.x #1204 (See https://builds.apache.org/job/maven-3.x/1204/ ) MNG-5607 Don't use M2_HOME anymore in mvn shell/batch file anymore (schulte: rev d3b4fb0c1e525bb1122c7e832279f1ef6fbd6efe) apache-maven/src/bin/mvn.cmd apache-maven/src/bin/mvn
          Hide
          dantran Dan Tran added a comment -

          Lots of ppl use M2_HOME to switch their Maven installation locations externally. May want to emphasize this in release notes

          Show
          dantran Dan Tran added a comment - Lots of ppl use M2_HOME to switch their Maven installation locations externally. May want to emphasize this in release notes
          Hide
          aheritier Arnaud HERITIER added a comment -

          Yes I have a big doubt to change this for 3.4.x
          We can introduce it with MVN_HOME value that takes M2_HOME as value if it exists but Otherwise I think it is dangerous. I'm sure that in various integrations of Maven M2_HOME is used ...

          Show
          aheritier Arnaud HERITIER added a comment - Yes I have a big doubt to change this for 3.4.x We can introduce it with MVN_HOME value that takes M2_HOME as value if it exists but Otherwise I think it is dangerous. I'm sure that in various integrations of Maven M2_HOME is used ...
          Hide
          aheritier Arnaud HERITIER added a comment -

          Have a look at this : https://github.com/search?q=M2_HOME&type=Code&utf8=
          You'll just see how it is widely used.
          Thus yes we can add MVN_HOME ( = M2_HOME) which isn't difficult to do and backward compatible but I'm not in favor to just rename M2_HOME to MVN_HOME or to remove M2_HOME

          Show
          aheritier Arnaud HERITIER added a comment - Have a look at this : https://github.com/search?q=M2_HOME&type=Code&utf8= ✓ You'll just see how it is widely used. Thus yes we can add MVN_HOME ( = M2_HOME) which isn't difficult to do and backward compatible but I'm not in favor to just rename M2_HOME to MVN_HOME or to remove M2_HOME
          Hide
          michael-o Michael Osipov added a comment -

          I do agree that breaking changes should be introduced in 4.0 only.

          Why do we actually need this environment variable at all in the scripts? Mixing scripts from one version with another installation is a source of error for me.

          Show
          michael-o Michael Osipov added a comment - I do agree that breaking changes should be introduced in 4.0 only. Why do we actually need this environment variable at all in the scripts? Mixing scripts from one version with another installation is a source of error for me.
          Hide
          schulte77 Christian Schulte added a comment -

          Here is what I responded to on dev@.

          The first commit removes support for M2_HOME in 3.4 completely. The
          second commit only renames a variable used in the script. M2_HOME is
          just not needed and is even confusing. People relying on M2_HOME should
          just setup theire PATH properly, IMHO. That's what most of them do
          anyway. You see

          export PATH=$M2_HOME/bin:$PATH

          almost everywhere. I am pretty sure there are a lot of people who do not
          even notice that setting M2_HOME to something not matching theire PATH
          is not what they want. Having a 'mvn' script in my PATH and having that
          script use a M2_HOME variable to launch something not in my PATH is
          flawed. I thought that was the reason for the request to remove that
          variable. No big deal reverting those commits, of course.

          So +1 for removing that variable completely in 3.4 or whatever version
          is appropriate for such a change.

          Show
          schulte77 Christian Schulte added a comment - Here is what I responded to on dev@. The first commit removes support for M2_HOME in 3.4 completely. The second commit only renames a variable used in the script. M2_HOME is just not needed and is even confusing. People relying on M2_HOME should just setup theire PATH properly, IMHO. That's what most of them do anyway. You see export PATH=$M2_HOME/bin:$PATH almost everywhere. I am pretty sure there are a lot of people who do not even notice that setting M2_HOME to something not matching theire PATH is not what they want. Having a 'mvn' script in my PATH and having that script use a M2_HOME variable to launch something not in my PATH is flawed. I thought that was the reason for the request to remove that variable. No big deal reverting those commits, of course. So +1 for removing that variable completely in 3.4 or whatever version is appropriate for such a change.
          Hide
          schulte77 Christian Schulte added a comment -

          That variable is breaking things. So I am fine with removing it in 3.4 already. Re-opening this issue and reverting those commits now.

          Show
          schulte77 Christian Schulte added a comment - That variable is breaking things. So I am fine with removing it in 3.4 already. Re-opening this issue and reverting those commits now.
          Hide
          hudson Hudson added a comment -

          SUCCESS: Integrated in maven-3.x #1205 (See https://builds.apache.org/job/maven-3.x/1205/)
          MNG-5607 Don't use M2_HOME anymore in mvn shell/batch file anymore (schulte: rev e37117e304d17e5b2defb4b2f7b2c67c0e2a1fe2)

          • apache-maven/src/bin/mvn
          • apache-maven/src/bin/mvnyjp
          • apache-maven/src/bin/mvnDebug
          • apache-maven/src/bin/mvn.cmd
          Show
          hudson Hudson added a comment - SUCCESS: Integrated in maven-3.x #1205 (See https://builds.apache.org/job/maven-3.x/1205/ ) MNG-5607 Don't use M2_HOME anymore in mvn shell/batch file anymore (schulte: rev e37117e304d17e5b2defb4b2f7b2c67c0e2a1fe2) apache-maven/src/bin/mvn apache-maven/src/bin/mvnyjp apache-maven/src/bin/mvnDebug apache-maven/src/bin/mvn.cmd
          Hide
          michael-o Michael Osipov added a comment -

          AS written by Jason on the mailing list. Rather remove completely than rename. This is an internal variable which makes it implementation-specific and at our discretion to remove.

          Show
          michael-o Michael Osipov added a comment - AS written by Jason on the mailing list. Rather remove completely than rename. This is an internal variable which makes it implementation-specific and at our discretion to remove.
          Hide
          khmarbaise Karl Heinz Marbaise added a comment -

          I would also suggest to completely remove this M2_HOME variable...if you use it to change between different maven versions it will fail if changing from Maven 3.2.5 to Maven 3.3.1 (based on the introduced multiModule...)...So best is to remove it...Rename does not really make sense cause this means changing the bad with the worse...and much more confusion user side...I use simply a link on Mac/Linux to change between Maven versions...and best is to simply use the path nothing else...From user perspective just to remove it makes more sense than to rename it...

          Show
          khmarbaise Karl Heinz Marbaise added a comment - I would also suggest to completely remove this M2_HOME variable...if you use it to change between different maven versions it will fail if changing from Maven 3.2.5 to Maven 3.3.1 (based on the introduced multiModule...)...So best is to remove it...Rename does not really make sense cause this means changing the bad with the worse...and much more confusion user side...I use simply a link on Mac/Linux to change between Maven versions...and best is to simply use the path nothing else...From user perspective just to remove it makes more sense than to rename it...
          Hide
          michael-o Michael Osipov added a comment -

          I second that!

          Show
          michael-o Michael Osipov added a comment - I second that!
          Hide
          michael-o Michael Osipov added a comment -

          Guys, let's take on this for 3.4.0...

          Show
          michael-o Michael Osipov added a comment - Guys, let's take on this for 3.4.0...
          Hide
          michael-o Michael Osipov added a comment -
          Show
          michael-o Michael Osipov added a comment - Fixed with fe47a3d79ffbb68a9e64ac5324be7a7544cbed4f .
          Hide
          hudson Hudson added a comment -

          FAILURE: Integrated in maven-3.x #1256 (See https://builds.apache.org/job/maven-3.x/1256/)
          MNG-5607 Don't use M2_HOME in mvn shell/command scripts anymore (michaelo: rev fe47a3d79ffbb68a9e64ac5324be7a7544cbed4f)

          • apache-maven/src/bin/mvn
          • apache-maven/src/bin/mvnDebug.cmd
          • apache-maven/src/bin/mvnyjp
          • apache-maven/src/bin/mvnDebug
          • apache-maven/src/bin/mvn.cmd
          Show
          hudson Hudson added a comment - FAILURE: Integrated in maven-3.x #1256 (See https://builds.apache.org/job/maven-3.x/1256/ ) MNG-5607 Don't use M2_HOME in mvn shell/command scripts anymore (michaelo: rev fe47a3d79ffbb68a9e64ac5324be7a7544cbed4f) apache-maven/src/bin/mvn apache-maven/src/bin/mvnDebug.cmd apache-maven/src/bin/mvnyjp apache-maven/src/bin/mvnDebug apache-maven/src/bin/mvn.cmd
          Hide
          hudson Hudson added a comment -

          SUCCESS: Integrated in maven-3.x #1276 (See https://builds.apache.org/job/maven-3.x/1276/)
          MNG-5607 Don't use M2_HOME in mvn shell/command scripts anymore (michaelo: rev e5dd48b5fadaaa793bf82c1e817eb970b0f87fc6)

          • maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
          Show
          hudson Hudson added a comment - SUCCESS: Integrated in maven-3.x #1276 (See https://builds.apache.org/job/maven-3.x/1276/ ) MNG-5607 Don't use M2_HOME in mvn shell/command scripts anymore (michaelo: rev e5dd48b5fadaaa793bf82c1e817eb970b0f87fc6) maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
          Hide
          stephenc Stephen Connolly added a comment -

          Maven 3.4.0 has been dropped. See this thread for more details.

          This issue will need to be re-scheduled for a Maven release in the (hopefully near) future.

          Show
          stephenc Stephen Connolly added a comment - Maven 3.4.0 has been dropped. See this thread for more details. This issue will need to be re-scheduled for a Maven release in the (hopefully near) future.
          Hide
          michael-o Michael Osipov added a comment -
          Show
          michael-o Michael Osipov added a comment - Fixed with 065281c43d7435be204aa963e1f94d1128bb5351 .
          Hide
          hudson Hudson added a comment -

          SUCCESS: Integrated in Jenkins build maven-3.x #1524 (See https://builds.apache.org/job/maven-3.x/1524/)
          MNG-5607 Don't use M2_HOME in mvn shell/command scripts anymore (michaelo: http://git-wip-us.apache.org/repos/asf/?p=maven.git&a=commit&h=065281c43d7435be204aa963e1f94d1128bb5351)

          • (edit) apache-maven/src/bin/mvn
          • (edit) maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
          • (edit) apache-maven/src/bin/mvnDebug
          • (edit) apache-maven/src/bin/mvnyjp
          • (edit) apache-maven/src/bin/mvnDebug.cmd
          • (edit) apache-maven/src/bin/mvn.cmd
          Show
          hudson Hudson added a comment - SUCCESS: Integrated in Jenkins build maven-3.x #1524 (See https://builds.apache.org/job/maven-3.x/1524/ ) MNG-5607 Don't use M2_HOME in mvn shell/command scripts anymore (michaelo: http://git-wip-us.apache.org/repos/asf/?p=maven.git&a=commit&h=065281c43d7435be204aa963e1f94d1128bb5351 ) (edit) apache-maven/src/bin/mvn (edit) maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java (edit) apache-maven/src/bin/mvnDebug (edit) apache-maven/src/bin/mvnyjp (edit) apache-maven/src/bin/mvnDebug.cmd (edit) apache-maven/src/bin/mvn.cmd

            People

            • Assignee:
              michael-o Michael Osipov
              Reporter:
              khmarbaise Karl Heinz Marbaise
            • Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development