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

Allow for a sorted log when --batch-mode is used in a multi module project #1151

Open
royscheefhals opened this issue Sep 25, 2024 · 0 comments

Comments

@royscheefhals
Copy link

Hello!

We use maven-daemon to allow for a much better developer experience when dealing with multi module projects.
We also use parallel builds in our CI/CD pipelines, but this is currently using regular maven mvn -T <threads> .

Using parallel builds with regular maven results in an unsorted build logfile, rendering it almost unusable.

We're looking at using maven daemon to allow for a sorted log, but unfortunately using mvnd clean --batch-mode also results in an unsorted logfile. Although, it does prepend each logline tags in the form of [project_id] <message>.

I located the line that eventually directly prints the tagged logline:

if (prj == null) {
log.accept(bm.getMessage());
} else if (noBuffering || dumb) {
String msg;
if (maxThreads > 1) {
msg = String.format("[%s] %s", bm.getProjectId(), bm.getMessage());
} else {
msg = bm.getMessage();
}
log.accept(msg);
} else {
prj.log.add(bm.getMessage());
}

Line 401 is what is printed

My Suggestion

Why not remove the block L394-L401 and just allow for the log to still be buffered per project?

So, just always do prj.log.add(bm.getMessage());.

What are your thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant