in buildSrc/src/main/groovy/org/elasticsearch/hadoop/gradle/BuildPlugin.groovy [674:733]
private static void configurePom(Project project, MavenPublication publication) {
// Set the pom's destination to the distribution directory
project.tasks.withType(GenerateMavenPom).all { GenerateMavenPom pom ->
if (pom.name == "generatePomFileFor${publication.name.capitalize()}Publication") {
BasePluginExtension baseExtension = project.getExtensions().getByType(BasePluginExtension.class);
pom.destination = project.provider({"${project.buildDir}/distributions/${baseExtension.archivesName.get()}-${project.getVersion()}.pom"})
}
}
// add all items necessary for publication
Provider<String> descriptionProvider = project.provider({ project.getDescription() })
MavenPom pom = publication.getPom()
pom.name = descriptionProvider
pom.description = descriptionProvider
pom.url = 'http://github.com/elastic/elasticsearch-hadoop'
pom.organization {
name = 'Elastic'
url = 'https://www.elastic.co/'
}
pom.licenses {
license {
name = 'The Apache Software License, Version 2.0'
url = 'https://www.apache.org/licenses/LICENSE-2.0.txt'
distribution = 'repo'
}
}
pom.scm {
url = 'https://github.com/elastic/elasticsearch-hadoop'
connection = 'scm:git:git://github.com/elastic/elasticsearch-hadoop'
developerConnection = 'scm:git:git://github.com/elastic/elasticsearch-hadoop'
}
pom.developers {
developer {
name = 'Elastic'
url = 'https://www.elastic.co'
}
}
publication.getPom().withXml { XmlProvider xml ->
// add all items necessary for publication
Node root = xml.asNode()
// If we have embedded configuration on the project, remove its dependencies from the dependency nodes
NodeList dependenciesNode = root.get("dependencies") as NodeList
Configuration embedded = project.getConfigurations().findByName('embedded')
if (embedded != null) {
embedded.getAllDependencies().all { Dependency dependency ->
Iterator<Node> dependenciesIterator = dependenciesNode.get(0).children().iterator()
while (dependenciesIterator.hasNext()) {
Node dependencyNode = dependenciesIterator.next()
String artifact = dependencyNode.get("artifactId").text()
if (artifact == dependency.getName()) {
dependenciesIterator.remove()
break
}
}
}
}
}
}