-
Notifications
You must be signed in to change notification settings - Fork 875
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
Improve maven multithreaded execution detection. #5482
Conversation
java/maven/src/org/netbeans/modules/maven/options/MavenSettings.java
Outdated
Show resolved
Hide resolved
java/maven/src/org/netbeans/modules/maven/options/MavenSettings.java
Outdated
Show resolved
Hide resolved
java/maven/src/org/netbeans/modules/maven/options/MavenSettings.java
Outdated
Show resolved
Hide resolved
awesome. We have a red master situation atm, have to resolve that first before starting the tests here. Going to be back later I promise :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me - thanks for fixing this.
good thinking regarding the optimization, this is certainly quicker than checking jar contents.
just a question, is this email address correct?
https://github.com/apache/netbeans/actions/runs/4175903071/jobs/7231902202#step:4:24
it looks a bit project specific :)
Yeah that's fine. Normally I create an e-mail address per purpose. |
@asbachb I believe we should think about this a bit more :) One difference between mvnd and maven is that mvnd uses different default settings. It uses the "smart builder" and uses more threads. The maven standard builder can be set via So the question is, while using mvnd:
It might be better to base the decision whether event spy should be used based on the computed settings, not based on whether the executable is mvnd or maven. |
@mbien I know the code is and was not optimal. The multi threaded detection is not very robust. On the other hand that PR makes the standard use case (don't configure any threading manually) somehow workable. So from my point of view for now it's more important that multi modules give some output at all than having a nice output for single module projects.
I don't know tbh. Based on the previous code I'd say: no. As it was disabled on purpose.
What do you mean by "builder type"?
From my understanding the Final note: The output when running |
I do agree that this is an important fix. But we should also check if there is a way to not cause regressions in single module projects which could potentially use the event spy. There is no need to rush this in yet, lets wait a bit - we are early in the NB 18 cycle.
the previous code expected that
explained here: https://peter.palaga.org/2021/01/11/mvnd-parallel-builds.html, mvnd also uses a different builder than maven.
yes this will be hard to fix if at all possible with the current way the console works |
Maybe it makes sense to split the PR. So we at least could merge the performance optimizations. |
I don't think that would be a good idea for |
it is still a warmed up daemon even when single threaded. |
I'd rather have fast builds then nice console output. But maybe it's just a personal preference. |
This comment was marked as outdated.
This comment was marked as outdated.
I'm not sure it's that easy. This would also trigger |
Let me prepare a proposal for the logic. I'm working on something including unit tests. |
I know. This is just a test setup so that we can experiment with this a bit better since the old impl of the method would return true too often. @asbachb we could potentially merge this as is and update things later in follow ups. But again: there is no hurry, lets play with this a bit a week or two and then decide what to do. |
@mbien I pushed a change to my branch maybe you'd like to have a look: 4f58f54 So the base idea was to extract the functionality somehow in order to be able to do some unit testing. Maybe it's a little bit overkill to have two separated classes but I thought it might be more clear that there is a different behavior between default maven and maven daemon. Love to hear your thoughts. Edit: There are still some bugs. Just as proposal how we could handle the check. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like it overall. Comments inline for you to consider. (only a quick review)
java/maven/src/org/netbeans/modules/maven/execute/MavenCommandLineExecutor.java
Outdated
Show resolved
Hide resolved
...rc/org/netbeans/modules/maven/execute/cmd/analyzer/MavenDaemonCommandParametersAnalyzer.java
Outdated
Show resolved
Hide resolved
...rc/org/netbeans/modules/maven/execute/cmd/analyzer/MavenDaemonCommandParametersAnalyzer.java
Outdated
Show resolved
Hide resolved
@asbachb you ok with me pushing a commit to this PR? Would like to try to get this in for NB18. |
Sure. Feel free to force push and reorganize as you like.
|
rebased to latest master since we had some more maven changes in the meantime, squashed everything, CI will produce a dev-build to play around with. changes:
let me know what you think if you have time. Its probably worth to take another look at maven command line flags to check if there are more we should add. |
General remark: From my understanding mvnd could also be configured via configuration file. So just relying on the command line parameters might result in non working configurations as well. |
@asbachb yeah true, lets ignore this for now. mvnd itself is a moving target atm. There might be even a way to talk to the daemon directly for IDEs some time in future, without having to pretend to be a shell. |
mvnd
added a check for |
mvn is ST by default, mvnd is MT by default. Lets try to detect the execution mode a bit better by inspecting the command line parameters. MT modes can't use the event spy. contains minor performance improvement: try to get maven version by analyzing `maven-core.jar` file name. this is a lot faster than opening the jar, parsing and evaluating the properties file. Since the file name approach does not work for maven 2 the previous logic was kept. Co-authored-by: Michael Bien <mbien42@gmail.com>
As
mvnd
is multi threaded by default we need to disable the event spy which is normally disabled when using multiple threads. This fixes #5479 .The PR also contains a performance fix which saves some time on every maven command execution