-
Notifications
You must be signed in to change notification settings - Fork 403
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support compile and runtime scopes for a library in the output pom #321
Comments
+1 👍 |
As a workaround you could just replace the publishing configuration in publishing.publications {
shadow(MavenPublication) { publication ->
publication.artifact(project.tasks.shadowJar)
publication.pom { pom ->
pom.withXml { xml ->
def dependenciesNode = xml.asNode().appendNode('dependencies')
project.configurations.shadow.allDependencies.each {
if (! (it instanceof SelfResolvingDependency)) {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version)
dependencyNode.appendNode('scope', 'compile')
}
}
}
}
}
} |
👍 to this - I'm using this plugin to relocate all of the runtime-style dependencies while keeping the api type dependencies in the POM as |
👍 as well, similar use case as @mkobit . Would be nice to have better support for |
@johnrengelman Could you comment on whether this is still an active issue that will be addressed in a future version, or is there a different solution for it now? We publish libraries using Shadow and our customers have complained about exactly this problem. |
Currently shadow jar will put all non shaded dependencies into the runtime scope, even if they were originally, logically at least, in the "compile" scope
This is done here -> https://github.com/johnrengelman/shadow/blob/master/src/main/groovy/com/github/jengelman/gradle/plugins/shadow/ShadowJavaPlugin.groovy#L78
This causes problems in libraries that require their dependencies in the compile scope (ie, they use a transitive dependency class in their public api).
It would be good to be able have a
shadowCompile
option in the dependencies block that means the jar is put into the compile scope in the pom rather than runtime.Shadow Version
2.0.1
The text was updated successfully, but these errors were encountered: