Publish Maven Shade Plugin in a Gradle BOM (Java-Platform)

Hi Team,

I have a Maven BOM (pom) which I am trying to migrate to gradle. I have been able to do so by using the java-platform plugin which generates the maven pom.

The original Maven BOM has a maven-shade-plugin within it, which when inherited by another project, causes it to generate executable jars. However the generated POM by the gradle java-platform plugin does not contain this maven-shade-plugin.

I was able to create an executable jar of the child project by adding the shadow plugin
id("com.github.johnrengelman.shadow") version "7.1.2"

but I am trying to figure out if there is a way to accomplish the same using the gradle java-platform.

Can someone please share if there is a way to achieve the same?

Besides that shade and shadow plugins are a bad idea per-se (see https://fatjar.net for some quotes), Gradle does not have the inheritance concept maven has. If you want to define build logic centrally, create convention plugins that do the configuration you want and then apply those to the projects where you want to have them in effect.

1 Like