I want to package it not in a single executable jar for distribution. I need an executable to be something like main.jar and all dependencies to be in libs/*.jar
How
I prefer this a bit modified solution. Create Your executable jar with classpath set and copy all dependencies to given directory.
You don't need any additional files.
Dependencies are being copied during install phase.
org.apache.maven.plugins
maven-jar-plugin
true
lib/
fully.qualified.MainClass
org.apache.maven.plugins
maven-dependency-plugin
install
copy-dependencies
${project.build.directory}/lib
runtime
provided
I updated the answer to copy only runtime dependencies as described here - copying the right dependencies. Test and provided dependencies are excluded.
It turns out that if you want to exclude dependencies from both the test and provided scopes, you need to exclude the provided scope and include the runtime scope.