Skip to content

Commit f43a9a1

Browse files
Backport to branch(3) : Add Maven publishing support for the ScalarDB Data Loader CLI module (#3130)
Co-authored-by: Pham Ba Thong <thong8111996@gmail.com>
1 parent 05781c3 commit f43a9a1

File tree

2 files changed

+58
-8
lines changed

2 files changed

+58
-8
lines changed

build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ jreleaser {
109109
def stagingRepositories = ['core/build/staging-deploy',
110110
'integration-test/build/staging-deploy',
111111
'schema-loader/build/staging-deploy',
112-
'data-loader/core/build/staging-deploy']
112+
'data-loader/core/build/staging-deploy',
113+
'data-loader/cli/build/staging-deploy']
113114
mavenCentral {
114115
sonatype {
115116
active = 'RELEASE'

data-loader/cli/build.gradle

Lines changed: 56 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,7 @@ plugins {
22
id 'net.ltgt.errorprone' version "${errorpronePluginVersion}"
33
id 'com.github.johnrengelman.shadow' version "${shadowPluginVersion}"
44
id 'com.github.spotbugs' version "${spotbugsPluginVersion}"
5-
id 'application'
6-
}
7-
8-
application {
9-
mainClass = 'com.scalar.db.dataloader.cli.DataLoaderCli'
5+
id 'maven-publish'
106
}
117

128
base {
@@ -34,10 +30,9 @@ javadoc {
3430

3531
// Build a fat jar
3632
shadowJar {
37-
mustRunAfter distZip, distTar
3833
archiveClassifier.set("")
3934
manifest {
40-
attributes 'Main-Class': 'com.scalar.db.dataloader.DataLoaderCli'
35+
attributes 'Main-Class': 'com.scalar.db.dataloader.cli.DataLoaderCli'
4136
}
4237
mergeServiceFiles()
4338
}
@@ -80,3 +75,57 @@ task docker(type: Exec) {
8075
workingDir 'build/docker'
8176
commandLine 'docker', 'build', "--tag=ghcr.io/scalar-labs/scalardb-data-loader-cli:${project.version}", "."
8277
}
78+
79+
// for archiving and uploading to maven central
80+
if (project.gradle.startParameter.taskNames.any { it.endsWith('publish') } ||
81+
project.gradle.startParameter.taskNames.any { it.endsWith('publishToMavenLocal') }) {
82+
// not to publish the fat jar to maven central
83+
shadowJar.enabled = false
84+
}
85+
86+
publishing {
87+
publications {
88+
mavenJava(MavenPublication) {
89+
artifactId = 'scalardb-data-loader-cli'
90+
from components.java
91+
pom {
92+
name = 'ScalarDB Data Loader CLI'
93+
description = 'CLI application for exporting data from and importing data into ScalarDB'
94+
url = 'https://github.com/scalar-labs/scalardb'
95+
licenses {
96+
license {
97+
name = 'Apache License, Version 2.0'
98+
url = 'http://www.apache.org/licenses/LICENSE-2.0'
99+
}
100+
}
101+
developers {
102+
developer {
103+
id = 'hiroyuki'
104+
name = 'Hiroyuki Yamada'
105+
email = 'hiroyuki.yamada@scalar-labs.com'
106+
}
107+
developer {
108+
id = 'brfrn169'
109+
name = 'Toshihiro Suzuki'
110+
email = 'brfrn169@gmail.com'
111+
}
112+
developer {
113+
id = 'Torch3333'
114+
name = 'Vincent Guilpain'
115+
email = 'vincent.guilpain@scalar-labs.com'
116+
}
117+
}
118+
scm {
119+
connection = 'scm:git:https://github.com/scalar-labs/scalardb.git'
120+
developerConnection = 'scm:git:https://github.com/scalar-labs/scalardb.git'
121+
url = 'https://github.com/scalar-labs/scalardb'
122+
}
123+
}
124+
}
125+
}
126+
repositories {
127+
maven {
128+
url = layout.buildDirectory.dir('staging-deploy')
129+
}
130+
}
131+
}

0 commit comments

Comments
 (0)