Skip to content

Commit

Permalink
Resolve dependency issues between jar and zip maven publications (#39)
Browse files Browse the repository at this point in the history
* Resolve dependency issues between jar and zip maven publications

Signed-off-by: Peter Zhu <zhujiaxi@amazon.com>

* Remove comments

Signed-off-by: Peter Zhu <zhujiaxi@amazon.com>

* Tweak typo

Signed-off-by: Peter Zhu <zhujiaxi@amazon.com>

---------

Signed-off-by: Peter Zhu <zhujiaxi@amazon.com>
  • Loading branch information
peterzhuamazon authored Sep 9, 2023
1 parent a62123b commit 64e4332
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 28 deletions.
75 changes: 47 additions & 28 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ plugins {
id 'java'
}

apply plugin: 'opensearch.opensearchplugin'
apply plugin: 'opensearch.internal-cluster-test'
apply plugin: 'opensearch.pluginzip'

repositories {
mavenLocal()
mavenCentral()
Expand All @@ -50,11 +54,12 @@ allprojects {
if (isSnapshot) {
version += "-SNAPSHOT"
}
}

apply plugin: 'opensearch.opensearchplugin'
apply plugin: 'opensearch.internal-cluster-test'
apply plugin: 'opensearch.pluginzip'
plugins.withId('java') {
targetCompatibility = JavaVersion.VERSION_11
sourceCompatibility = JavaVersion.VERSION_11
}
}

opensearchplugin {
name 'opensearch-custom-codecs'
Expand All @@ -68,33 +73,52 @@ dependencies {
api "com.github.luben:zstd-jni:1.5.5-5"
}

allprojects {
// Default to the apache license
project.ext.licenseName = 'The Apache Software License, Version 2.0'
project.ext.licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
publishing {
repositories {
maven {
name = 'staging'
url = "${rootProject.buildDir}/local-staging-repo"
}
}
publications {
// add license information to generated poms
all {
pom {
name = "opensearch-custom-codecs"
description = "OpenSearch plugin that implements custom compression codecs"
}
pom.withXml { XmlProvider xml ->
Node node = xml.asNode()
node.appendNode('inceptionYear', '2021')

Node license = node.appendNode('licenses').appendNode('license')
license.appendNode('name', project.licenseName)
license.appendNode('url', project.licenseUrl)

Node developer = node.appendNode('developers').appendNode('developer')
developer.appendNode('name', 'OpenSearch')
developer.appendNode('url', 'https://github.com/opensearch-project/custom-codecs')
}
}
}
}
}

publishing {
publications {
pluginZip(MavenPublication) { publication ->
pom {
name = opensearchplugin.name
description = opensearchplugin.description
name = "opensearch-custom-codecs"
description = "OpenSearch plugin that implements custom compression codecs"
groupId = "org.opensearch.plugin"
licenses {
license {
name = "The Apache License, Version 2.0"
url = "http://www.apache.org/licenses/LICENSE-2.0.txt"
}
}
developers {
developer {
name = "OpenSearch"
url = "https://github.com/opensearch-project/custom-codecs"
}
}
}
}
}
repositories {
maven {
name = 'staging'
url = "${rootProject.buildDir}/local-staging-repo"
}
maven {
name = "Snapshots"
url = "https://aws.oss.sonatype.org/content/repositories/snapshots"
Expand Down Expand Up @@ -125,9 +149,4 @@ tasks.withType(Javadoc).configureEach { Javadoc javadoc ->

testingConventions.enabled = false
loggerUsageCheck.enabled = false

tasks.matching {it.path in [":validateMavenPom", ":validateNebulaPom", ":validatePluginZipPom"]}.all { task ->
task.dependsOn ':generatePomFileForNebulaPublication', ':generatePomFileForPluginZipPublication'
}

tasks.named("publishNebulaPublicationToMavenLocal").configure { dependsOn("generatePomFileForPluginZipPublication") }
validateNebulaPom.enabled = false
1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
*/

rootProject.name = "opensearch-custom-codecs"
startParameter.excludedTaskNames=["publishPluginZipPublicationToMavenLocal", "publishPluginZipPublicationToStagingRepository"]

0 comments on commit 64e4332

Please sign in to comment.