@@ -5,6 +5,7 @@ plugins {
55 id ' application'
66 id ' signing'
77 id ' maven-publish'
8+ id " com.vanniktech.maven.publish" version " 0.34.0"
89}
910
1011group = ' com.matchory.packages'
@@ -29,8 +30,6 @@ repositories {
2930java {
3031 sourceCompatibility = JavaVersion . VERSION_21
3132 targetCompatibility = JavaVersion . VERSION_21
32- withJavadocJar()
33- withSourcesJar()
3433}
3534
3635sourceSets. main. java. srcDirs = [" src/main/java" ]
@@ -112,8 +111,8 @@ tasks.processResources {
112111 def buildArch = System . getProperty(" os.arch" ). toLowerCase()
113112 def isCrossCompiling = (currentOs != buildOs) || (currentArch != buildArch)
114113
115- if (! isCrossCompiling && file(" ${ buildDir } /libs/jpostal/shared" ). exists()) {
116- from(" ${ buildDir } /libs/jpostal/shared" ) {
114+ if (! isCrossCompiling && file(" ${ rootProject.layout.buildDirectory } /libs/jpostal/shared" ). exists()) {
115+ from(" ${ rootProject.layout.buildDirectory } /libs/jpostal/shared" ) {
117116 include ' *.so' , ' *.dylib' , ' *.dll'
118117 into(" native" )
119118 rename { filename ->
@@ -193,8 +192,8 @@ jar {
193192 def buildOsFolder = buildOs. contains(" mac" ) ? " macos" : " linux"
194193 def buildArchFolder = buildArch. contains(" aarch64" ) || buildArch. contains(" arm" ) ? " aarch64" : " x86_64"
195194
196- if (file(" ${ buildDir } /libs/jpostal/shared" ). exists()) {
197- from(" ${ buildDir } /libs/jpostal/shared" ) {
195+ if (file(" ${ rootProject.layout.buildDirectory } /libs/jpostal/shared" ). exists()) {
196+ from(" ${ rootProject.layout.buildDirectory } /libs/jpostal/shared" ) {
198197 include ' *.so' , ' *.dylib' , ' *.dll'
199198 into(" native/${ buildOsFolder} /${ buildArchFolder} " )
200199 rename { filename ->
@@ -223,89 +222,63 @@ jar {
223222}
224223
225224application {
226- applicationDefaultJvmArgs = [" -Djava.library.path=" + file(" ${ buildDir } /libs/jpostal/shared" ). absolutePath]
225+ applicationDefaultJvmArgs = [" -Djava.library.path=" + file(" ${ rootProject.layout.buildDirectory } /libs/jpostal/shared" ). absolutePath]
227226}
228227
229228dependencies {
230229 testImplementation ' junit:junit:4.+'
231230}
232231
233232tasks. withType(Test ). configureEach {
234- systemProperty " java.library.path" , file(" ${ buildDir } /libs/jpostal/shared" ). absolutePath
233+ systemProperty " java.library.path" , file(" ${ rootProject.layout.buildDirectory } /libs/jpostal/shared" ). absolutePath
235234}
236235
237- artifacts {
238- archives javadocJar, sourcesJar
239- }
240-
241- publishing {
242- publications {
243- mavenJava(MavenPublication ) {
244- groupId = ' com.matchory.packages'
245- artifactId = ' jpostal'
246- version = ' 1.0.0'
236+ mavenPublishing {
237+ coordinates(" com.matchory.packages" , " jpostal" , getProperty(" version" ). toString(). replaceFirst(" ^v" , " " ))
238+ publishToMavenCentral()
247239
248- from components. java
240+ // Configure signing - try in-memory first, fall back to file-based
241+ if (project. hasProperty(" signingInMemoryKey" ) || project. hasProperty(" signing.keyId" )) {
242+ signAllPublications()
243+ }
249244
250- versionMapping {
251- usage(' java-api' ) {
252- fromResolutionOf(' runtimeClasspath' )
253- }
254- usage(' java-runtime' ) {
255- fromResolutionResult()
256- }
245+ pom {
246+ name = ' jpostal'
247+ description = ' Java/JNI bindings to libpostal for fast international street address parsing/normalization'
248+ url = ' https://github.com/matchory/jpostal'
249+ developers {
250+ developer {
251+ id = ' openvenues'
252+ name = ' Open Venues'
253+ url = ' https://github.com/openvenues'
257254 }
258-
259- pom {
260- name = ' jpostal'
261- description = ' Java/JNI bindings to libpostal for fast international street address parsing/normalization'
262- url = ' https://github.com/matchory/jpostal'
263- developers {
264- developer {
265- id = ' openvenues'
266- name = ' Open Venues'
267- url = ' https://github.com/openvenues'
268- }
269- developer {
270- id = ' matchory'
271- name = ' Matchory GmbH'
272- url = ' https://github.com/matchory'
273- }
274- }
275- licenses {
276- license {
277- name = ' MIT'
278- }
279- }
280- scm {
281- connection = ' scm:git:git://github.com/matchory/libpostal.git'
282- developerConnection = ' scm:git:ssh://github.com/matchory/libpostal.git'
283- url = ' https://github.com/matchory/libpostal'
284- }
255+ developer {
256+ id = ' matchory'
257+ name = ' Matchory GmbH'
258+ url = ' https://github.com/matchory'
285259 }
286260 }
287- }
288-
289- repositories {
290- maven {
291- name = ' com.matchory.packages.jpostal'
292- url = layout. buildDirectory. dir(" repo" )
293- }
294- maven {
295- name = " GitHubPackages"
296- url = " https://maven.pkg.github.com/matchory/jpostal"
297- credentials {
298- username = System . getenv(" GITHUB_ACTOR" )
299- password = System . getenv(" GITHUB_TOKEN" )
261+ licenses {
262+ license {
263+ name = ' MIT'
300264 }
301265 }
266+ scm {
267+ connection = ' scm:git:git://github.com/matchory/libpostal.git'
268+ developerConnection = ' scm:git:ssh://github.com/matchory/libpostal.git'
269+ url = ' https://github.com/matchory/libpostal'
270+ }
302271 }
303272}
304273
305- signing {
306- sign configurations. archives
307- sign publishing. publications. mavenJava
308- }
274+ // signing {
275+ // required {
276+ // gradle.taskGraph.hasTask("publish") &&
277+ // (project.hasProperty("signing.keyId") || System.getenv("GPG_PRIVATE_KEY") != null)
278+ // }
279+ // sign configurations.archives
280+ // sign publishing.publications.mavenJava
281+ // }
309282
310283javadoc {
311284 if (JavaVersion . current(). isJava9Compatible()) {
0 commit comments