-
-
Notifications
You must be signed in to change notification settings - Fork 184
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
Reload Project and recursively all Modules #324
Reload Project and recursively all Modules #324
Conversation
src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java
Outdated
Show resolved
Hide resolved
Thats the first time I've used BeanShell. So please tell me if I have done something weird or strange 😃 |
src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java
Outdated
Show resolved
Hide resolved
The test seems to hold too much, probably some simple goal would be enough, but it is not a big deal. Can you think of any negative impact of building all the projects can lead to? Please squash all changes to single commit and force push to this branch. |
I would love to see a simpler, more elegant solution! But that was the naive solution to demonstrate our Problem. All commits squashed. |
|
||
for (ProjectBuildingResult projectBuildingResult : result) { | ||
MavenProject resultProject = projectBuildingResult.getProject(); | ||
if (!resultProject.isExecutionRoot()) continue; |
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.
Any reason to use continue
instead of positive if
and return
? Also can you use brackets {}
even for one line if.
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.
With JDK 8 onward I would write it like
private MavenProject reloadProject(final MavenProject project) throws MojoFailureException {
try {
return projectBuilder
.build(
Collections.singletonList(project.getFile()),
true,
mavenSession.getProjectBuildingRequest())
.stream()
.map(ProjectBuildingResult::getProject)
.filter(MavenProject::isExecutionRoot)
.findAny().orElseThrow(() -> new NoSuchElementException(
"None of the ProjectBuildingResults is for the executionRoot"));
} catch (Exception e) {
throw new MojoFailureException("Error re-loading project info", e);
}
}
The notation with continue seems closer to the stream filter notation to me. But I don't mind changing it to a positive if condition.
Well, let's see how it behaves in real life then :) |
</dependency> | ||
</dependencies> | ||
</dependencyManagement> | ||
</project> |
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.
Nitpick: Some POMs end with a newline (like this), others don't (like src/it/release-start-finish-2-it/expectations/develop/withAgregatorAsParent/expected-pom.xml
).
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.
also some pom.xml files hat an indentation with of only two spaces. Fixed that too.
src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java
Outdated
Show resolved
Hide resolved
src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java
Outdated
Show resolved
Hide resolved
This is my gut feeling, too. @dirk-kaspar let's have a look afterwards, maybe we can open another PR improving (i.e. minimizing) the IT.
Performance, maybe? We didn't do a proper performance test, but since we do a complete rebuild, this might increase execution time. On the other hand: we didn't observe anything becoming slower, at least in our pipelines. |
Co-authored-by: beatngu13 <daniel.kraus@mailbox.org>
Thank you. Good job! |
The Changes suggested from @beatngu13 in Issue #130