We have Project-Core that provides a base functionality. Project-X uses the Project-Core.
Project-Core is internally a multi-module project. To avoid deploying all the sub-modules, we create a fat-jar (uber-jar) using maven-shade-plugin. Project-Core also has external dependencies such as Spring. The result is a fat 45MB jar.
Now for Project-X to use Project-Core, it includes the dependency-reduced-pom of the fat-jar and it works fine.
However, this approach is a little inflexible: If Project-X wants to exclude or use newer versions of dependencies, it is not possible.
Alternatively, Project-Core deploys a slim-jar with only core implementation, but excluding all external dependencies - this is possible with shade-plugin configuration. However, Project-X needs to include all external dependencies explicitly. This is cumbersome as they need to know the dependencies and the right versions.
A better approach:
The slim-jar is deployed with a custom POM that includes external dependencies. Project-X can then include this custom POM and still get all dependencies without including them explicitly. It also provides flexibility to exclude / upgrade dependencies.
Question: How to create slim-jar custom POM that retains only the external dependencies?
Tried playing around with createDependencyReducedPom and keepDependenciesWithProvidedScope options (https://maven.apache.org/plugins/maven-shade-plugin/shade-mojo.html), none of which meet the purpose.