Skip to content

Commit

Permalink
Add maven uploadArchives support
Browse files Browse the repository at this point in the history
  • Loading branch information
Vincent Royer committed Oct 17, 2017
1 parent b960c59 commit 44a3c9e
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 32 deletions.
81 changes: 51 additions & 30 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,61 +33,82 @@ subprojects {
description = "Elasticsearch subproject ${project.path}"
}

ext.enableArtifactSigning = !version.endsWith("SNAPSHOT") && project.hasProperty("repoUsername")
ext.repoUsername = { project.hasProperty("repoUsername") ? getProperty("repoUsername") : "" }
ext.repoPassword = { project.hasProperty("repoPassword") ? getProperty("repoPassword") : "" }

Path rootPath = rootDir.toPath()
// setup pom license info, but only for artifacts that are part of elasticsearch
configure(subprojects.findAll { it.projectDir.toPath().startsWith(rootPath) }) {

configure(subprojects.findAll { it.projectDir.toPath().endsWith('core') }) {
apply plugin: 'maven'
apply plugin: 'signing'

// we only use maven publish to add tasks for pom generation
plugins.withType(MavenPublishPlugin).whenPluginAdded {
publishing {
publications {
// add license information to generated poms
all {
pom.withXml { XmlProvider xml ->
Node node = xml.asNode()
node.appendNode('inceptionYear', '2015')

Node license = node.appendNode('licenses').appendNode('license')
license.appendNode('name', 'The Apache Software License, Version 2.0')
license.appendNode('url', 'http://www.apache.org/licenses/LICENSE-2.0.txt')
license.appendNode('distribution', 'repo')

Node developer = node.appendNode('developers').appendNode('developer')
developer.appendNode('name', 'Elastic & Strapdata')
developer.appendNode('url', 'http://www.strapdata.com')
}
}
maven(MavenPublication) {
from components.java
artifacts {
archives sourcesJar
archives javadocJar
}
}
}
}
}
}

/*
allprojects {
apply plugin: 'signing'
apply plugin: 'maven'
// Signature of artifacts
signing {
sign configurations.archives

if (enableArtifactSigning) {
signing {
sign configurations.archives
}
}

// OSSRH publication
uploadArchives {
repositories {
mavenDeployer {
uploadDescriptor = true

// POM signature
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }

// Target repository
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: repoUsername, password: repoPassword)
}

// SNAPSHOT repository
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: repoUsername, password: repoPassword)
}

pom.withXml { XmlProvider xml ->
Node node = xml.asNode()
node.appendNode('name',it.name)
node.appendNode('description',"Elasticsearch subproject")
node.appendNode('url', 'http://github.com/strapdata/elassandra')
node.appendNode('inceptionYear', '2015')

Node license = node.appendNode('licenses').appendNode('license')
license.appendNode('name', 'The Apache Software License, Version 2.0')
license.appendNode('url', 'http://www.apache.org/licenses/LICENSE-2.0.txt')
license.appendNode('distribution', 'repo')

def scm = node.appendNode('scm')
scm.appendNode('url', 'http://github.com/strapdata/elassandra')
scm.appendNode('connection', 'scm:git:git@github.com:strapdata/elassandra.git')
scm.appendNode('developerConnection', 'scm:git:git@github.com:strapdata/elassandra.git')

Node developer = node.appendNode('developers').appendNode('developer')
developer.appendNode('name', 'Elastic and Strapdata')
developer.appendNode('url', 'https://github.com/strapdata/elassandra')
developer.appendNode('organizationUrl', '//http://www.strapdata.com/')
}
}
}
}
}
}
*/

// introspect all versions of ES that may be tested agains for backwards compatibility
Version currentVersion = Version.fromString(VersionProperties.elasticsearch.minus('-SNAPSHOT'))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,11 @@ class VagrantTestPlugin implements Plugin<Project> {
}

private static void createCleanTask(Project project) {
project.tasks.create('clean', Delete.class) {
project.tasks.create('cleanCustom', Delete.class) {

This comment has been minimized.

Copy link
@DBarthe

DBarthe Oct 18, 2017

Contributor

@vroyer C'est quoi le but de ce changement ?

This comment has been minimized.

Copy link
@vroyer

vroyer via email Oct 18, 2017

This comment has been minimized.

Copy link
@DBarthe

DBarthe via email Oct 18, 2017

Contributor
description 'Clean the project build directory'
group 'Build'
delete project.buildDir
dependsOn 'clean'
}
}

Expand Down
2 changes: 1 addition & 1 deletion distribution/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ project.rootProject.subprojects.findAll { it.path.startsWith(':modules:transport
// make sure we have a clean task since we aren't a java project, but we have tasks that
// put stuff in the build dir
task clean(type: Delete) {
delete 'build'
delete 'build'
}

configure(distributions) {
Expand Down

0 comments on commit 44a3c9e

Please sign in to comment.