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

Dev mode recompiles upon startup #699

Open
ericglau opened this issue Dec 4, 2019 · 5 comments
Open

Dev mode recompiles upon startup #699

ericglau opened this issue Dec 4, 2019 · 5 comments

Comments

@ericglau
Copy link
Contributor

ericglau commented Dec 4, 2019

OpenLiberty/ci.common#111 added a recompile when dev mode starts up, so any compile errors would be shown. However, even if there were no compile errors originally, it will still recompile and cause the application to update.

[INFO] Press the Enter key to run tests on demand.
[INFO] Source compilation was successful.
[INFO] Tests compilation was successful.
[INFO] [AUDIT   ] CWWKT0017I: Web application removed (default_host): http://localhost:9080/
[INFO] [AUDIT   ] CWWKZ0009I: The application getting-started has stopped successfully.
[INFO] [AUDIT   ] CWWKT0016I: Web application available (default_host): http://localhost:9080/
[INFO] [AUDIT   ] CWWKZ0003I: The application getting-started updated in 0.268 seconds.
@scottkurz
Copy link
Member

Hmm..our pretty simple JSF+JPA stack sample https://github.com/OpenLiberty/application-stack-samples/tree/main/jpa seems to keep failing "hot tests" on dev mode startup. Guess I'm just noting this as another symptom of this issue.

@kathrynkodama
Copy link
Contributor

Currently dev mode is compiling twice on startup:

  1. Calling the maven-compiler-plugin:compile where any compilation errors are logged as warnings.
  2. Via the processJavaCompilation method once Liberty has started and the watch loop has been entered to bring attention to any compilation errors on startup after the server and dev mode has started.

Ideally we would only compile once and bring attention to any compilation errors on startup. This would resolve the above issue as if there was a successful initial compilation, we would not recompile and cause the app to update. This could be done two ways:

  1. Capturing and parsing the output of the maven-compiler-plugin so that we could re-display it to the user after dev mode has started
  2. Refactor the logic from the processJavaCompilation method such that the one and only compile on startup would be done directly through dev mode (not the maven compiler plugin). This seems more favourable.

@scottkurz
Copy link
Member

I wonder if my previous comment: #699 (comment) suggests that maybe the hot test execution part of the loop should be changed somehow to wait for the second compilation?

I didn't think to grab the logs but could if we don't already understand what's going on well enough.

@kathrynkodama
Copy link
Contributor

@scottkurz We are looking at making this change as part of the multi-module story (though the change will affect both single module and multi module projects). The first time we run tests in the hot testing scenario, we wait for the second compilation to finish. Once that's implemented it may address the hot tests failing on dev mode startup error that you've encountered

@scottkurz
Copy link
Member

To move this forwards, I wrote up a POC for the single-module case...

https://github.com/scottkurz/ci.common/tree/skip-init-compile
https://github.com/scottkurz/ci.maven/tree/skip-init-compile

The idea is to:

  • switch the compile mojo invocation to failOnError=true (currently LMP is setting it to false)
  • catch a MojoExecutionException on compile mojo failure and set a flag
  • pass the flag to the common DevUtil which will then only do the initial compile if the flag is set.

TODO:

  • multi-module
  • clean up code, refactor, fix logging

It seems to basically work though, for the three cases: nothing to compile, good & bad compiles

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: To Discuss
Development

No branches or pull requests

4 participants