tisonkun / os-detector

Detect OS/Platform information for Java program.
Apache License 2.0
5 stars 2 forks source link

Tone down Maven plugin output #12

Closed gnodet closed 1 month ago

gnodet commented 1 month ago

The current output for a project that uses this Maven extension is the following (when running with Maven 3.x):

➜  camel git:(cleanup-dep-mgmt) ~/.sdkman/candidates/maven/3.9.8/bin/mvn foo     
[INFO] ------------------------------------------------------------------------
[INFO] Detecting the operating system and CPU architecture
[INFO] ------------------------------------------------------------------------
[INFO] os.detected.name: osx
[INFO] os.detected.arch: aarch_64
[INFO] os.detected.bitness: 64
[INFO] os.detected.version: 14.6
[INFO] os.detected.version.major: 14
[INFO] os.detected.version.minor: 6
[INFO] os.detected.classifier: osx-aarch_64
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Detecting the operating system and CPU architecture
[INFO] ------------------------------------------------------------------------
[INFO] os.detected.name: osx
[INFO] os.detected.arch: aarch_64
[INFO] os.detected.bitness: 64
[INFO] os.detected.version: 14.6
[INFO] os.detected.version.major: 14
[INFO] os.detected.version.minor: 6
[INFO] os.detected.classifier: osx-aarch_64
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO] 
[INFO] Camel                                                              [pom]
[INFO] Camel :: Buildtools                                                [jar]
[INFO] Camel :: Parent                                                    [pom]

This is really verbose (and duplicate), so I'd suggest to just move all the log to debug in Maven.

gnodet commented 1 month ago

After this change, what's the output?

The output you attached seems have some duplicate. Not sure this patch keep one output or filter out all.

The duplicate run is kind expected. At least it was this way in the original plugin. The session is injected at the very beginning, and then after projects are read to allow injecting into projects. With the PR, nothing should be logged at all at INFO level, but everything will be moved to DEBUG. What we could do is just add a single INFO output so that we can easily check that the maven plugin is actually in use and doing it's work.

gnodet commented 1 month ago

I pushed some changes. The output is the following:

➜  camel git:(cleanup-dep-mgmt) ~/.sdkman/candidates/maven/3.9.8/bin/mvn foo -N                                          
[INFO] The os-detector Maven 3 extension is registered, OS and CPU architecture properties will be provided.
[INFO] Scanning for projects...
[INFO] 
...
➜  camel git:(cleanup-dep-mgmt) ~/.sdkman/candidates/maven/3.9.8/bin/mvn foo -N -X
Apache Maven 3.9.8 (36645f6c9b5079805ea5009217e36f2cffd34256)
Maven home: /Users/gnodet/.sdkman/candidates/maven/3.9.8
Java version: 21.0.4, vendor: Eclipse Adoptium, runtime: /Users/gnodet/.sdkman/candidates/java/21.0.4-tem
Default locale: en_FR, platform encoding: UTF-8
OS name: "mac os x", version: "14.6.1", arch: "aarch64", family: "Mac"
... <ommitted debug output from maven>...
[INFO] The os-detector Maden 3 extension is registered, OS and CPU architecture properties will be provided.
[DEBUG] ------------------------------------------------------------------------
[DEBUG] Detecting the operating system and CPU architecture
[DEBUG] ------------------------------------------------------------------------
[DEBUG] os.detected.name: osx
[DEBUG] os.detected.arch: aarch_64
[DEBUG] os.detected.bitness: 64
[DEBUG] os.detected.version: 14.6
[DEBUG] os.detected.version.major: 14
[DEBUG] os.detected.version.minor: 6
[DEBUG] os.detected.classifier: osx-aarch_64
[INFO] Scanning for projects...
... <ommitted debug output from maven>...
[DEBUG] ------------------------------------------------------------------------
[DEBUG] Detecting the operating system and CPU architecture
[DEBUG] ------------------------------------------------------------------------
[DEBUG] os.detected.name: osx
[DEBUG] os.detected.arch: aarch_64
[DEBUG] os.detected.bitness: 64
[DEBUG] os.detected.version: 14.6
[DEBUG] os.detected.version.major: 14
[DEBUG] os.detected.version.minor: 6
[DEBUG] os.detected.classifier: osx-aarch_64
...
➜  camel git:(cleanup-dep-mgmt) ~/work/git/maven/apache-maven/target/apache-maven-4.0.0-beta-5-SNAPSHOT/bin/mvn foo -N -X
[INFO] The os-detector Maven 4 extension is registered, OS and CPU architecture properties will be provided.
[INFO] Scanning for projects...
...
➜  camel git:(cleanup-dep-mgmt) ~/work/git/maven/apache-maven/target/apache-maven-4.0.0-beta-5-SNAPSHOT/bin/mvn foo -N -X
Apache Maven 4.0.0-beta-5-SNAPSHOT (3b151c0d3c881b83058e55838a3a50b1588d8e78)
Maven home: /Users/gnodet/work/git/maven/apache-maven/target/apache-maven-4.0.0-beta-5-SNAPSHOT
Java version: 21.0.4, vendor: Eclipse Adoptium, runtime: /Users/gnodet/.sdkman/candidates/java/21.0.4-tem
Default locale: en_FR, platform encoding: UTF-8
OS name: "mac os x", version: "14.6.1", arch: "aarch64", family: "mac"
... <ommitted debug output from maven>...
[INFO] The os-detector Maven 4 extension is registered, OS and CPU architecture properties will be provided.
[DEBUG] ------------------------------------------------------------------------
[DEBUG] Detecting the operating system and CPU architecture
[DEBUG] ------------------------------------------------------------------------
[DEBUG] os.detected.name: osx
[DEBUG] os.detected.arch: aarch_64
[DEBUG] os.detected.bitness: 64
[DEBUG] os.detected.version: 14.6
[DEBUG] os.detected.version.major: 14
[DEBUG] os.detected.version.minor: 6
[DEBUG] os.detected.classifier: osx-aarch_64
[INFO] Scanning for projects...
...
gnodet commented 1 month ago

Please give me some time before releasing, the above change made me realise the extension was working on Maven master, but not on 4.0.0-beta-4, so I'd like to provide a fix before next release.

gnodet commented 1 month ago

Thanks. Let me know if this is good to merge.

You can change PR to draft if you find any other blocker.

And I'd appreciate it if you can link the related Maven PR you mentioned above.

Feel free to merge and release. I cannot find a way to make it work on Maven 4.0.0-beta-4, so it'll require coming beta-5 anyway...

tisonkun commented 1 month ago

Thank you!