Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to list the java version of all my maven dependencies?

Tags:

java

maven

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?

like image 576
Jason Thompson Avatar asked Jun 05 '14 13:06

Jason Thompson


People also ask

How do I know what version of Java Maven is using?

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.

Where can I find Maven dependencies?

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.

How can I see dependencies of a jar?

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.


1 Answers

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

like image 152
Dev Avatar answered Oct 06 '22 15:10

Dev