Fat jar. Java multi project build

Can anyone help me I just need an example to follow.

This is all Java code.

I have 2 sub projects
Project a has common code
Project a has external jar dependencies like Apache common etc.
Project b depends on project a
Project b has a main class
Project b has other external jar dependencies.

I want to make a executable jar that has all the code from project a and project b in it with the main class the class in project b.

I’ve tried doing a jar task
I’ve set project b to depend on a
I’ve used configuration.classPath.collect directory or ziptree.

What I end up with is a jar with all project a in it but no main class from project b.


A simple example will do it