Skip to content

Instantly share code, notes, and snippets.

@mrserverless
Created December 22, 2014 00:15
Show Gist options
  • Save mrserverless/1ef286f8f4a693bfbeda to your computer and use it in GitHub Desktop.
Save mrserverless/1ef286f8f4a693bfbeda to your computer and use it in GitHub Desktop.
Gradle maven publish replace default runtime scope with compile scope. See: http://forums.gradle.org/gradle/topics/using_the_maven_publish_plugin_no_dependencies_in_pom_xml
publishing {
publications {
mavenJava(MavenPublication) {
pom.withXml {
asNode().dependencies.'*'.findAll() {
it.scope.text() == 'runtime' && project.configurations.compile.allDependencies.find { dep ->
dep.name == it.artifactId.text()
}
}.each() {
it.scope*.value = 'compile'
}
}
from components.java
artifact sourcesJar {
classifier "sources"
}
artifact javadocJar {
classifier "javadoc"
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment