Skip to content

Commit 64e4332

Browse files
Resolve dependency issues between jar and zip maven publications (#39)
* 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>
1 parent a62123b commit 64e4332

File tree

2 files changed

+48
-28
lines changed

2 files changed

+48
-28
lines changed

build.gradle

+47-28
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ plugins {
3434
id 'java'
3535
}
3636

37+
apply plugin: 'opensearch.opensearchplugin'
38+
apply plugin: 'opensearch.internal-cluster-test'
39+
apply plugin: 'opensearch.pluginzip'
40+
3741
repositories {
3842
mavenLocal()
3943
mavenCentral()
@@ -50,11 +54,12 @@ allprojects {
5054
if (isSnapshot) {
5155
version += "-SNAPSHOT"
5256
}
53-
}
5457

55-
apply plugin: 'opensearch.opensearchplugin'
56-
apply plugin: 'opensearch.internal-cluster-test'
57-
apply plugin: 'opensearch.pluginzip'
58+
plugins.withId('java') {
59+
targetCompatibility = JavaVersion.VERSION_11
60+
sourceCompatibility = JavaVersion.VERSION_11
61+
}
62+
}
5863

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

76+
allprojects {
77+
// Default to the apache license
78+
project.ext.licenseName = 'The Apache Software License, Version 2.0'
79+
project.ext.licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
80+
publishing {
81+
repositories {
82+
maven {
83+
name = 'staging'
84+
url = "${rootProject.buildDir}/local-staging-repo"
85+
}
86+
}
87+
publications {
88+
// add license information to generated poms
89+
all {
90+
pom {
91+
name = "opensearch-custom-codecs"
92+
description = "OpenSearch plugin that implements custom compression codecs"
93+
}
94+
pom.withXml { XmlProvider xml ->
95+
Node node = xml.asNode()
96+
node.appendNode('inceptionYear', '2021')
97+
98+
Node license = node.appendNode('licenses').appendNode('license')
99+
license.appendNode('name', project.licenseName)
100+
license.appendNode('url', project.licenseUrl)
101+
102+
Node developer = node.appendNode('developers').appendNode('developer')
103+
developer.appendNode('name', 'OpenSearch')
104+
developer.appendNode('url', 'https://github.com/opensearch-project/custom-codecs')
105+
}
106+
}
107+
}
108+
}
109+
}
110+
71111
publishing {
72112
publications {
73113
pluginZip(MavenPublication) { publication ->
74114
pom {
75-
name = opensearchplugin.name
76-
description = opensearchplugin.description
115+
name = "opensearch-custom-codecs"
116+
description = "OpenSearch plugin that implements custom compression codecs"
77117
groupId = "org.opensearch.plugin"
78-
licenses {
79-
license {
80-
name = "The Apache License, Version 2.0"
81-
url = "http://www.apache.org/licenses/LICENSE-2.0.txt"
82-
}
83-
}
84-
developers {
85-
developer {
86-
name = "OpenSearch"
87-
url = "https://github.com/opensearch-project/custom-codecs"
88-
}
89-
}
90118
}
91119
}
92120
}
93121
repositories {
94-
maven {
95-
name = 'staging'
96-
url = "${rootProject.buildDir}/local-staging-repo"
97-
}
98122
maven {
99123
name = "Snapshots"
100124
url = "https://aws.oss.sonatype.org/content/repositories/snapshots"
@@ -125,9 +149,4 @@ tasks.withType(Javadoc).configureEach { Javadoc javadoc ->
125149

126150
testingConventions.enabled = false
127151
loggerUsageCheck.enabled = false
128-
129-
tasks.matching {it.path in [":validateMavenPom", ":validateNebulaPom", ":validatePluginZipPom"]}.all { task ->
130-
task.dependsOn ':generatePomFileForNebulaPublication', ':generatePomFileForPluginZipPublication'
131-
}
132-
133-
tasks.named("publishNebulaPublicationToMavenLocal").configure { dependsOn("generatePomFileForPluginZipPublication") }
152+
validateNebulaPom.enabled = false

settings.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@
77
*/
88

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

0 commit comments

Comments
 (0)