plugin used : id 'com.github.johnrengelman.shadow' version '4.0.4'
Gradle : https://services.gradle.org/distributions/gradle-7.4.2-bin.zip
getting error :
A problem occurred evaluating root project 'iot-bulk-slice-worker'.
> Could not get unknown property 'shadow' for project of type org.gradle.api.Project.
for :
plugins {
id 'com.github.johnrengelman.shadow' version '4.0.4'
//id 'com.github.johnrengelman.shadow' version '7.1.1'
}
if (subproject.name in gradle.platforms) {
subproject.publishing {
publications {
code(MavenPublication) { publication ->
publication.artifactId = gradle.platforms ['artifactName']
from components.java
}
shadow(MavenPublication) { publication ->
publication.artifactId ="${subproject.name}"
subproject.shadow.component(publication)
}
}
}
}
}
It is still a little difficult to say without the complete build file. But I assume the
subprojectvariable is exactly that - a subproject. In that case, you are configuring a publication on a subproject that uses theshadowextension from itself.This means to
shadowplugin has to be applied to the subproject. From the snippets, you are only applying it to the root project.Could be something like this: