-
Notifications
You must be signed in to change notification settings - Fork 304
Introduce "offline" mode #424
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
Conversation
Version 3.0.0 started to look at "ahead" and "behind" branches. To do so, it executes a Fetch command to the repo. This is unfortunate because it introduces quite a bit of a delay when building, especially when the machine is offline (e.g. on a plane). Also, it sets off various alerts because the previous version did not do any remote access. This PR introduces an "offline" mode (disables by default) that allows turning off all commands that are trying to reach out to remotes. Currently, that is only the fetch command which is executed when trying to determine "ahead" and "behind". Any future operation that is accessing remote repos should also check this flag.
Hi, thanks for your contribution! I'd agree that this Does the exclusion of the ahead and behind properties still trigger a fetch?
? |
Looking through the code, it seems that the This switch would also allow to be triggered in a profile to turn remote access on and off (I use that in connection with properties in the basepom project all the time). I also updated the PR to respect the maven "-o" offline switch to put maven in offline mode. |
Hi, thanks for your input. |
* The Maven settings. | ||
*/ | ||
@Parameter(property = "settings", required = true, readonly = true) | ||
Settings settings; |
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.
This new settings sadly makes the tests fail.
Inside the GitIntegrationTest you also would need to mock them:
private static Settings mockSettings() {
Settings settings = mock(Settings.class);
when(settings.isOffline()).thenReturn(false);
return settings;
}
Could you perhaps add this mock? I think besides that this should be good to be merged.
Hey, sorry for breaking the tests. I added the change to the code; it now builds on my laptop (and also on the CI). |
Perfect! Thank you for your contribution and your patience to address my comments ;-) I'm going ahead and merge. This feature will become available in the next version. |
Version 3.0.0 started to look at "ahead" and "behind" branches. To do
so, it executes a Fetch command to the repo. This is unfortunate
because it introduces quite a bit of a delay when building, especially
when the machine is offline (e.g. on a plane). Also, it sets off
various alerts because the previous version did not do any remote
access.
This PR introduces an "offline" mode (disabled by default) that allows
turning off all commands that are trying to reach out to
remotes. Currently, that is only the fetch command which is executed
when trying to determine "ahead" and "behind". Any future operation
that is accessing remote repos should also check this flag.
Context
Contributor Checklist
mvn clean package
checkstyle
coding style definition:mvn clean verify -Pcheckstyle -Dmaven.test.skip=true -B