Publish fat jar and thin jar for a project

I am trying to publish both fat jar and thin jar artifacts for a specific project.
When I include the shadow plugin logic to publish the fat jar, bot the artifacts are published with dependencies only.
If I remove the shadow plugin logic and try publishing thin jar, it works well.

build.gradle changes used for publishing.
publishing {
publications {
code(MavenPublication) {
groupId ‘’
shadow(MavenPublication) { publication ->
groupId ‘’

artifactoryPublish {
publications (‘code’)
publications (‘shadow’)

I have tried using plugin/mavenJava/mavenPlugin instead of code. If I remove the shadow block, I could succesfully publish thin jar. If i include shadow block it is publishing both jars with dependencies included.

Is it possible to publish fat jar and thin jar at a time? Am I missing anything?

It is possible.

Try removing the artifactoryPublish block, and call gradle publish.

(You can also assign to group at the top level instead of calling groupId.)