@@ -2,6 +2,9 @@ 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 ' maven-publish'
6+ id ' signing'
7+ id ' base'
58}
69
710archivesBaseName = " scalardb-data-loader-core"
@@ -41,3 +44,67 @@ spotbugsTest.reports {
4144 html. enabled = true
4245}
4346spotbugsTest. excludeFilter = file(" ${ project.rootDir} /gradle/spotbugs-exclude.xml" )
47+
48+ if (project. gradle. startParameter. taskNames. any { it. endsWith(' publish' ) } ||
49+ project. gradle. startParameter. taskNames. any { it. endsWith(' publishToMavenLocal' ) }) {
50+ // not to publish the fat jar to maven central
51+ shadowJar. enabled = false
52+ }
53+
54+ publishing {
55+ publications {
56+ mavenJava(MavenPublication ) {
57+ artifactId = ' scalardb-data-loader-core'
58+ from components. java
59+ pom {
60+ name = ' ScalarDB Data Loader Core'
61+ description = ' Core library for exporting data from and importing data into ScalarDB'
62+ url = ' https://github.com/scalar-labs/scalardb'
63+ licenses {
64+ license {
65+ name = ' Apache License, Version 2.0'
66+ url = ' http://www.apache.org/licenses/LICENSE-2.0'
67+ }
68+ }
69+ developers {
70+ developer {
71+ id = ' hiroyuki'
72+ name = ' Hiroyuki Yamada'
73+ 74+ }
75+ developer {
76+ id = ' brfrn169'
77+ name = ' Toshihiro Suzuki'
78+ 79+ }
80+ developer {
81+ id = ' Torch3333'
82+ name = ' Vincent Guilpain'
83+ 84+ }
85+ }
86+ scm {
87+ connection = ' scm:git:https://github.com/scalar-labs/scalardb.git'
88+ developerConnection = ' scm:git:https://github.com/scalar-labs/scalardb.git'
89+ url = ' https://github.com/scalar-labs/scalardb'
90+ }
91+ }
92+ }
93+ }
94+ repositories {
95+ maven {
96+ def releasesRepoUrl = " https://oss.sonatype.org/service/local/staging/deploy/maven2"
97+ def snapshotsRepoUrl = " https://oss.sonatype.org/content/repositories/snapshots"
98+ url = version. endsWith(' SNAPSHOT' ) ? snapshotsRepoUrl : releasesRepoUrl
99+ credentials {
100+ username = project. properties[' ossrhUsername' ] ?: " "
101+ password = project. properties[' ossrhPassword' ] ?: " "
102+ }
103+ }
104+ }
105+ }
106+
107+ signing {
108+ required { project. gradle. taskGraph. hasTask(" publish" ) }
109+ sign publishing. publications. mavenJava
110+ }
0 commit comments