@@ -11,6 +11,7 @@ buildscript {
1111
1212plugins {
1313 id ' java'
14+ id " com.vanniktech.maven.publish" version " latest.release"
1415 id ' maven-publish'
1516 id ' signing'
1617
@@ -199,9 +200,6 @@ compileJavacc {
199200}
200201
201202java {
202- withSourcesJar()
203- withJavadocJar()
204-
205203 sourceCompatibility = ' 11'
206204 targetCompatibility = ' 11'
207205
@@ -599,89 +597,73 @@ tasks.register('sphinx', Exec) {
599597 }
600598}
601599
602- publish {
603- dependsOn(check, gitChangelogTask, renderRR, xslt, xmldoc)
604- }
605-
606- publishing {
607- publications {
608- mavenJava(MavenPublication ) {
609- artifactId = ' jsqlparser'
610-
611- from(components. java)
600+ mavenPublishing {
601+ coordinates(group, " jsqlparser" , version)
612602
613- versionMapping {
614- usage(' java-api' ) {
615- fromResolutionOf(' runtimeClasspath' )
616- }
617- usage(' java-runtime' ) {
618- fromResolutionResult()
619- }
620- }
621-
622- pom {
623- name. set(' JSQLParser library' )
624- description. set(' Parse SQL Statements into Abstract Syntax Trees (AST)' )
625- url. set(' https://github.com/JSQLParser/JSqlParser' )
626-
627- licenses {
628- license {
629- name. set(' GNU Library or Lesser General Public License (LGPL) V2.1' )
630- url. set(' http://www.gnu.org/licenses/lgpl-2.1.html' )
631- }
632- license {
633- name. set(' The Apache Software License, Version 2.0' )
634- url. set(' http://www.apache.org/licenses/LICENSE-2.0.txt' )
603+ publishing {
604+ publications {
605+ mavenJava(MavenPublication ) { publication ->
606+ from components. java
607+ versionMapping {
608+ usage(' java-api' ) {
609+ fromResolutionOf(' runtimeClasspath' )
635610 }
636- }
637-
638- developers {
639- developer {
640- id. set(' twa' )
641- name. set(' Tobias Warneke' )
642- email. set(' t.warneke@gmx.net' )
611+ usage(' java-runtime' ) {
612+ fromResolutionResult()
643613 }
644- developer {
645- id. set(' are' )
646- name. set(' Andreas Reichel' )
647- email. set(' andreas@manticore-projects.com' )
614+ allVariants {
615+ fromResolutionResult()
648616 }
649617 }
650-
651- scm {
652- connection. set(' scm:git:https://github.com/JSQLParser/JSqlParser.git' )
653- developerConnection. set(' scm:git:ssh://git@github.com:JSQLParser/JSqlParser.git' )
654- url. set(' https://github.com/JSQLParser/JSqlParser.git' )
655- }
656618 }
657619 }
658620 }
659621
660- repositories {
661- maven {
662- name = " ossrh"
663- def releasesRepoUrl = " https://central.sonatype.com/repository/maven-releases"
664- def snapshotsRepoUrl = " https://central.sonatype.com/repository/maven-snapshots/"
665- url(version. endsWith(' SNAPSHOT' ) ? snapshotsRepoUrl : releasesRepoUrl)
622+ pom {
623+ name. set(' JSQLParser library' )
624+ description. set(' Parse SQL Statements into Abstract Syntax Trees (AST)' )
625+ url. set(' https://github.com/JSQLParser/JSqlParser' )
626+
627+ licenses {
628+ license {
629+ name. set(' GNU Library or Lesser General Public License (LGPL) V2.1' )
630+ url. set(' http://www.gnu.org/licenses/lgpl-2.1.html' )
631+ }
632+ license {
633+ name. set(' The Apache Software License, Version 2.0' )
634+ url. set(' http://www.apache.org/licenses/LICENSE-2.0.txt' )
635+ }
636+ }
666637
667- credentials {
668- username = providers. environmentVariable(" ossrhUsername" ). orNull
669- password = providers. environmentVariable(" ossrhPassword" ). orNull
638+ developers {
639+ developer {
640+ id. set(' twa' )
641+ name. set(' Tobias Warneke' )
642+ email. set(' t.warneke@gmx.net' )
643+ }
644+ developer {
645+ id. set(' are' )
646+ name. set(' Andreas Reichel' )
647+ email. set(' andreas@manticore-projects.com' )
670648 }
671649 }
650+
651+ scm {
652+ connection. set(' scm:git:https://github.com/JSQLParser/JSqlParser.git' )
653+ developerConnection. set(' scm:git:ssh://git@github.com:JSQLParser/JSqlParser.git' )
654+ url. set(' https://github.com/JSQLParser/JSqlParser.git' )
655+ }
672656 }
673657}
674658
659+ // Fix signing task dependencies
660+ tasks. withType(AbstractPublishToMaven ). configureEach {
661+ dependsOn(tasks. withType(Sign ))
662+ }
663+
675664
676665signing {
677- // def signingKey = findProperty("signingKey")
678- // def signingPassword = findProperty("signingPassword")
679- // useInMemoryPgpKeys(signingKey, signingPassword)
680-
681- // don't sign SNAPSHOTS
682- if (! version. endsWith(' SNAPSHOT' )) {
683- sign publishing. publications. mavenJava
684- }
666+ required { ! version. endsWith(" SNAPSHOT" ) && gradle. taskGraph. hasTask(" publish" ) }
685667}
686668
687669tasks. withType(JavaCompile ). configureEach {
0 commit comments