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

Set maven version like maven-wrapper #143

Closed
herder opened this issue Oct 25, 2020 · 15 comments
Closed

Set maven version like maven-wrapper #143

herder opened this issue Oct 25, 2020 · 15 comments
Labels
new feature wontfix This will not be worked on

Comments

@herder
Copy link

herder commented Oct 25, 2020

To ensure repeatable builds in a CI environment it would be great to be able specify desired maven version, like the Maven Wrapper plugin.

Or possibly detect if mvnw is present in the project directory and use that?

@ppalaga
Copy link
Contributor

ppalaga commented Oct 25, 2020

It is true that we embed Maven, but we modify it slightly. Pulling a random Maven version during the build and running with it would be rather risky because we test only against a single particular Maven version.

Providing our own mvndw script that would pull a specific version of mvnd would perhaps solve your problem too? I think that kind of solution would be more robust and I'd be open to accept such a contribution.

@ppalaga ppalaga closed this as completed Oct 25, 2020
@ppalaga
Copy link
Contributor

ppalaga commented Oct 25, 2020

Oh, sorry I did not want to close.

@ppalaga ppalaga reopened this Oct 25, 2020
@herder
Copy link
Author

herder commented Oct 26, 2020

Providing our own mvndw script that would pull a specific version of mvnd would perhaps solve your problem too? I think that kind of solution would be more robust and I'd be open to accept such a contribution.

That sounds like a good idea, if it's not possible to use Maven out of the box.

Adding a mvnd.version property that can be passed to the command line or put in mvnd.properties would be the easiest way to use this, I guess?

@ppalaga
Copy link
Contributor

ppalaga commented Oct 26, 2020

I thought it could work the very same way as with stock Maven:

  • A tool similar to Maven's wrapper plugin (mvn -N io.takari:maven:0.7.7:wrapper) would generate mvndw and mvndw.cmd scripts
  • Those scripts would either call mvnd already installed somewhere under ~/.m2 (e.g. /home/ppalaga/.m2/mvnd) or they would download and install mvnd before calling it from there.

@soerenhenkel
Copy link

Hm. Not sure if I understand that correctly, but this kind of solution would "only" allow to select a specific version of mvnd (like e.g. 0.0.9), wouldn't it?
I think in the end we would need to be able to select a specific mvn version (like e.g. 3.5.4, instead of 3.6.3 coming with mvnd).

@ppalaga
Copy link
Contributor

ppalaga commented Oct 26, 2020

we would need to be able to select a specific mvn version (like e.g. 3.5.4, instead of 3.6.3 coming with mvnd).

I am quite sure that supporting older Maven versions is not a priority for me and @gnodet but we are still open to contributions in case anybody else would like to work on that.

@herder
Copy link
Author

herder commented Oct 26, 2020

Would it be possible to summarize what modifications you need to do to Maven, @ppalaga ?
I could look it up I guess, but I might miss something :)

@ppalaga
Copy link
Contributor

ppalaga commented Oct 26, 2020

what modifications you need to do to Maven?

Start with downgrading Maven around here: https://github.com/mvndaemon/mvnd/blob/master/pom.xml#L46
and then make all integration tests pass.

@helpermethod
Copy link

helpermethod commented Oct 29, 2020

@herder Maybe not exactly the answer you are looking for, but:

With SDKMAN! it's possible to fix the mvnd version by using a .sdkmanrc file. That would allow you to use the same mvnd version with the same packaged mvn version on both dev machine and CI system (SDKMAN! can even configure the versions automatically on project directory entry).

The only thing missing currently is the functionality to automatically install the versions present in the .sdkmanrc file but I'm already working on it.

For more information:
https://sdkman.io/usage#env

@herder
Copy link
Author

herder commented Nov 2, 2020

Thinking about it this would maybe be better placed in the Maven-wrapper project? Since it downloads maven versions anyway, it might be easier to modify that script to either download the regular maven binary or a mvnd?

@gnodet
Copy link
Contributor

gnodet commented Nov 2, 2020

Fwiw, I think it would be nice if we could get mvnd to easily layout on top of any (or at least a set of supported) maven versions.
The main problem is currently the way the mvnd daemon starts maven. The DaemonMavenCli class has a bunch of changes compared to the default MavenCli so that we can reuse the same class loaders, else there can be no caching happening and thus few benefits in using a daemon. It needs to be investigate whether this can be done in a cleaner and less intrusive way.

@cyraid
Copy link

cyraid commented Mar 16, 2021

Would be nice to allow a way for, say, IntelliJ (which wants just a path to maven directory), to be able to enjoy the benefits just by running a 'mvn', and it will use the mvnd. Kinda like a 'drop-in' solution to use the benefits.

@gnodet
Copy link
Contributor

gnodet commented May 20, 2021

I'm not planning to actually come up with something that would work with multiple maven versions as mvnd is tightly coupled to maven unfortunately.

@lppedd
Copy link

lppedd commented Jan 31, 2023

Question: what's the plan on support for the Maven 3.x stream?
Will the Deamon be kept updated on that stream, or are we going to be forced to adopt Maven 4.x? (which might not be feasible for a lot of projects for some time).

@gnodet
Copy link
Contributor

gnodet commented Jan 31, 2023

Question: what's the plan on support for the Maven 3.x stream?
Will the Deamon be kept updated on that stream, or are we going to be forced to adopt Maven 4.x? (which might not be feasible for a lot of projects for some time).

I would think it will follow the maven 4.x stream. So we can plan on having mvnd with an embedded 3.x maven for some time. The 0.9.0 release is under vote, and I'll soon start a 0.10.0 based on maven 3.9.0 which is also being voted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

7 participants