Skip to content

Instantly share code, notes, and snippets.

@jmnarloch
Created September 17, 2015 14:01
Show Gist options
  • Save jmnarloch/1eb53a88759525661c3c to your computer and use it in GitHub Desktop.
Save jmnarloch/1eb53a88759525661c3c to your computer and use it in GitHub Desktop.
Gradle optional dependencies
def installer = install.repositories.mavenInstaller
def deployer = uploadArchives.repositories.mavenDeployer
[installer, deployer]*.pom*.whenConfigured {pom ->
def dependencyMap = project.configurations.compile.dependencies.collectEntries { [it.name, it] }
pom.dependencies.findAll {
def dep = dependencyMap[it.artifactId]
return dep?.hasProperty('optional') && dep.optional
}*.optional = true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment