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

Double logging with a Maven Extension #1258

Open
adrian-tarau opened this issue Feb 3, 2025 · 3 comments
Open

Double logging with a Maven Extension #1258

adrian-tarau opened this issue Feb 3, 2025 · 3 comments

Comments

@adrian-tarau
Copy link

I'm building an extension which has a few goals in mind (one is provided by mvnd, which is less logging :) ), and I have an undesired side effect at the end when the extension is printing the report.

Image

Since this is not the standard Maven, I cannot steal the logging (I also do not want that, as it will conflict with mvnd). However, I would like to detect when a build happens with mvnd and change the behavior a bit (like not printing the report at the end to the standard output since it is logged with regular logging). I could probably look at the source, but can you tell me what I can use (easily) to detect mvnd?

Thanks.

@adrian-tarau
Copy link
Author

adrian-tarau commented Feb 3, 2025

After I pressed send, I realized I could detect when regular Maven logging is available and react to that. It might still be good to know if it runs under mvnd; I might need to make other adjustments. Somebody asked to support mvnd, so I'm trying my best.

@cstamas
Copy link
Member

cstamas commented Feb 8, 2025

Simplest that comes to my mind is to try to load from (plugin) classloader a class typical for mvnd and not existing in mvn, for example org.apache.maven.cli.DaemonCli? Just throwing ideas in here...

@adrian-tarau
Copy link
Author

It's an extension, but the same Plexus class loader system is used in both cases. I'll try with org.apache.maven.cli.DaemonCli, thanks.

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

2 participants