I want to add jars, from another folder to my main jar at runtime, to make main jar lightweight. How to do it? I am using maven. I thought about scope provided, but I don't know how to add these jars.
./lib/hikari.jar
./lib/h2.jar ./
=============== =============
= = = =
= Hikari.jar = = =
= = ---------> = Main.jar =
= h2.jar = = =
= = = =
=============== =============
It depends how you are making the jar.
You can do the following, use maven-dependency-plugin to copy your libs and then configure the maven-jar-plugin to use the libs from the classpath, no need to change the scope of the dependencies.