Created
November 21, 2014 20:57
-
-
Save delor/f70560f14674b322dcd2 to your computer and use it in GitHub Desktop.
Gradle task for generating Maven's POM file for Android AAR
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
task createPom { | |
apply plugin: 'maven' | |
description "Generates pom.xml" | |
pom { | |
project { | |
groupId 'com.example' | |
artifactId 'example' | |
version '0.0.1-SNAPSHOT' | |
packaging 'aar' | |
} | |
}.withXml { | |
def dependenciesNode = asNode().appendNode('dependencies') | |
configurations.compile.allDependencies.each { dependency -> | |
def dependencyNode = dependenciesNode.appendNode('dependency') | |
dependencyNode.appendNode('groupId', dependency.group) | |
dependencyNode.appendNode('artifactId', dependency.name) | |
dependencyNode.appendNode('version', dependency.version) | |
} | |
}.writeTo("$buildDir/pom.xml") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Trying to run this results in the following exception: