1

We are using Gradle to build spring boot application.

Our application does not require commons-io. But one of the other dependencies requires commons-io. So we've not added commons-io as dependencies. gradle build worked fine.

But when we run the spring boot using "java -jar my-fat-jar.jar", it throws classNotFound Exception for a commons-io class. My fat jar does not contain commons-io in its lib folder.

So we just added commons-io as dependencies, now everything works fine.

But we don't want to add each such dependencies. Instead is there any way to include the dependent jars of my dependencies in lib folder of my fat jar?

Please note that we are using spring boot gradle plugin.

sag
  • 5,333
  • 8
  • 54
  • 91
  • 3
    The spring boot gradle plugin should resolve all your transitive dependencies and include them in the fat jar. Including it yourself sounds hacky if you're not using it directly. – Aritz Apr 22 '16 at 07:50
  • 1
    attach please your gradle.build – Cortwave Apr 22 '16 at 09:05
  • Only that one dependency missing? Because it can be the error of the "other dependencies" not listing it as a dependency. I had tis problem before with some libs sadly. Also you are sure it's not excluded? – Lakatos Gyula Apr 22 '16 at 09:07

0 Answers0