Created
September 17, 2015 14:01
-
-
Save jmnarloch/1eb53a88759525661c3c to your computer and use it in GitHub Desktop.
Gradle optional dependencies
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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