modern-java-practices icon indicating copy to clipboard operation
modern-java-practices copied to clipboard

Review Gradle and Maven output for warnings

Open binkley opened this issue 1 year ago • 3 comments

This project generates WARNING messages in the build from various tools. Some or many cases may be easily resolved, and as-is are "noise" in the build. Noise makes it harder for devs to see true problems.

Tasks

  • [x] Evaluate these, and see can be resolved sensibly. Attach to this card (see comments below)
  • [ ] Resolve Gradle warnings that are straight-forward
  • [ ] Resolve Maven warnings that are straight-forward
  • [ ] Document what fixes and workarounds cleaned up output in straight-forward cases
  • [ ] Document what is not easily resolved. Update the wiki pages to give insight for others

binkley avatar Jul 31 '24 13:07 binkley

Contrast the Gradle and Maven outputs for warnings. warnings-maven.txt warnings-gradle.txt

This warning from the Gradle plugin is potentially problematic:

timestamp PIT >> INFO : MINION : WARNING: Dynamic loading of agents will be disallowed by default in a future release

And implies this project picks up that update. This may depend on JDK version in use.

binkley avatar Jul 31 '24 15:07 binkley

Evaluating warning output from Gradle:

OpenJDK 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended

I don't feel this project should configure to make the JVM quieter. This warning is from plugins that use runtime configuration such as injecting an agent. PIT is the largest culprit in these warnings.

timestamp PIT >> INFO : MINION : WARNING: A Java agent has been loaded dynamically (/home/binkley/.gradle/caches/modules-2/files-2.1/net.bytebuddy/byte-buddy-agent/1.14.15/b4cc9d88d5de562bf75b3a54ab436ad01b3f72d/byte-buddy-agent-1.14.15.jar)

This is the kind of agent injection mentioned above.

timestamp PIT >> INFO : MINION : WARNING: If a serviceability tool is in use, please run with XX:+EnableDynamicAgentLoading to hide this warning

TODO: Decide if we should add this JVM flag. It will suppress warnings like this, but also make it harder to spot security issues.

timestamp PIT >> INFO : MINION : WARNING: If a serviceability tool is not in use, please run with -Djdk.instrument.traceUsage for more information

Another warning from plugins using agents.

timestamp PIT >> INFO : MINION : WARNING: Dynamic loading of agents will be disallowed by default in a future release

Another warning from plugins using agents.

timestamp PIT >> INFO : MINION : OpenJDK 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins. For more on this, please refer to > https://docs.gradle.org/8.9/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.

These seems to be generic warnings from Gradle as the PIT plugin needs an agent to modify bytecode.

binkley avatar Jul 31 '24 16:07 binkley

Evaluating warning output from Maven:

WARNING: A Java agent has been loaded dynamically (/home/binkley/.m2/repository/net/bytebuddy/byte-buddy-agent/1.14.15/byte-buddy-agent-1.14.15.jar) WARNING: If a serviceability tool is in use, please run with -XX:+EnableDynamicAgentLoading to hide this warning WARNING: If a serviceability tool is not in use, please run with -Djdk.instrument.traceUsage for more information WARNING: Dynamic loading of agents will be disallowed by default in a future release OpenJDK 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended

These seem to be related to bytecode manipulation tools. It is interesting that Gradle and Maven produce different warnings.

[WARNING] Unable to locate Source XRef to link to - DISABLED [WARNING] Unable to locate Source XRef to link to - DISABLED [WARNING] Unable to locate Source XRef to link to - DISABLED [WARNING] Unable to locate Source XRef to link to - DISABLED [WARNING] Unable to locate Source XRef to link to - DISABLED [WARNING] Unable to locate Source XRef to link to - DISABLED [WARNING] Unable to locate Source XRef to link to - DISABLED [WARNING] Unable to locate Source XRef to link to - DISABLED

This is as Maven pom.xml is setup to process Javadoc, and Gradle build.gradle is not. These are bad links in Javadoc and implies class paths or source paths in the Maven build need tweaking.

binkley avatar Jul 31 '24 16:07 binkley