-2

I want to print all the jars, along with their versions at runtime. I found this link, but it prints just the classpath resources.

EDIT

Ok. Can I log all jars along with their versions while building the project?

Community
  • 1
  • 1
daBigBug
  • 343
  • 2
  • 11
  • 2
    You mix stuff up badly. Maven is a **build tool**. You want to display something in runtime that has been present only during build. It's gone by the time you run the compiled code... (you could use the pom.xml in META-INF, but still, most likely you'd need a lot on your classpath to do so: maven, the dependency plugin, etc...) – ppeterka Aug 09 '16 at 18:48

1 Answers1

2

http://maven.apache.org/plugins/maven-dependency-plugin/examples/resolving-conflicts-using-the-dependency-tree.html

mvn dependency:tree

That's what you can get. Jars and versions.

But not at runtime ofc ;) Maven is a build tool. It builds. Not runs. So you can check current jars and versions (dependencies) you're project using. Read ppeterka comment above.

Nickname0222022022
  • 577
  • 1
  • 4
  • 22