Consider I have a maven java project that I wish to use the minimum version of Java possible. It has a number of dependencies. Is there a way I can see what the version of java used to compile the jar is for all of the resolved dependencies?
Before moving on, we can check the default JDK version of Maven. Running the mvn -v command will show the Java version in which Maven runs.
In your project's POM, press Ctrl and hover the mouse over the dependency. Click the dependency to open the dependency's POM. In the dependency POM, view the active dependency, its transitive dependencies and their versions. You can check the origin from which the dependency was pulled in.
jar file. Use the -verbose:class option to find class-level dependencies or use the -v or -verbose option to include dependencies from the same JAR file.
If you run mvn site
on your project, one of the default reports (the 'Dependencies' report) generated will give you details about your dependencies.
After running mvn site
find the target/site/dependencies.html
file and open it in a browser. The section entitled "Dependency File Details" has a table in which one of the columns is the JDK revision used to compile a given dependency.
The maven-project-info-reports-plugin is what is responsible for generating this information. If you just want to generate that single html report from the command line you can do so with the following command
mvn project-info-reports:dependencies
The report will be located in the same place as with mvn site
at target/site/dependencies.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With