@@ -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
@@ -62,16 +63,17 @@ def getVersion = { boolean considerSnapshot ->
6263 snapshot = " -SNAPSHOT"
6364 }
6465
65- return patch != null
66- ? " ${ major} .${ minor} .${ patch}${ snapshot} "
67- : " ${ major} .${ minor}${ snapshot} "
66+ return " ${ major} .${ minor} " +
67+ (patch != null ? " .${ patch} " : " " ) +
68+ (build != null ? " .${ build} " : " " ) +
69+ snapshot
6870}
6971
7072
7173// for publishing a release, call Gradle with Environment Variable RELEASE:
7274// RELEASE=true gradle JSQLParser:publish
7375version = getVersion( ! System . getenv(" RELEASE" ) )
74- group = ' com.github.jsqlparser '
76+ group = ' com.manticore-projects.jsqlformatter '
7577description = ' JSQLParser library'
7678
7779tasks. register(' generateBuildInfo' ) {
@@ -200,7 +202,7 @@ compileJavacc {
200202
201203java {
202204 withSourcesJar()
203- withJavadocJar()
205+ // withJavadocJar()
204206
205207 sourceCompatibility = ' 11'
206208 targetCompatibility = ' 11'
@@ -603,85 +605,56 @@ publish {
603605 dependsOn(check, gitChangelogTask, renderRR, xslt, xmldoc)
604606}
605607
606- publishing {
607- publications {
608- mavenJava(MavenPublication ) {
609- artifactId = ' jsqlparser'
608+ mavenPublishing {
609+ publishToMavenCentral(true )
610+ signAllPublications()
610611
611- from components . java
612+ coordinates(group, " jsqlparser " , version)
612613
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' )
635- }
636- }
614+ pom {
615+ name. set(' JSQLParser library' )
616+ description. set(' Parse SQL Statements into Abstract Syntax Trees (AST)' )
617+ url. set(' https://github.com/JSQLParser/JSqlParser' )
637618
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' )
648- }
649- }
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- }
619+ licenses {
620+ license {
621+ name. set(' GNU Library or Lesser General Public License (LGPL) V2.1' )
622+ url. set(' http://www.gnu.org/licenses/lgpl-2.1.html' )
623+ }
624+ license {
625+ name. set(' The Apache Software License, Version 2.0' )
626+ url. set(' http://www.apache.org/licenses/LICENSE-2.0.txt' )
656627 }
657628 }
658- }
659-
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)
666629
667- credentials {
668- username = providers. environmentVariable(" ossrhUsername" ). orNull
669- password = providers. environmentVariable(" ossrhPassword" ). orNull
630+ developers {
631+ developer {
632+ id. set(' twa' )
633+ name. set(' Tobias Warneke' )
634+ email. set(' t.warneke@gmx.net' )
670635 }
636+ developer {
637+ id. set(' are' )
638+ name. set(' Andreas Reichel' )
639+ email. set(' andreas@manticore-projects.com' )
640+ }
641+ }
642+
643+ scm {
644+ connection. set(' scm:git:https://github.com/JSQLParser/JSqlParser.git' )
645+ developerConnection. set(' scm:git:ssh://git@github.com:JSQLParser/JSqlParser.git' )
646+ url. set(' https://github.com/JSQLParser/JSqlParser.git' )
671647 }
672648 }
673649}
674650
651+ // Fix signing task dependencies
652+ tasks. withType(AbstractPublishToMaven ). configureEach {
653+ dependsOn(tasks. withType(Sign ))
654+ }
675655
676656signing {
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- }
657+ required { ! version. endsWith(" SNAPSHOT" ) && gradle. taskGraph. hasTask(" publish" ) }
685658}
686659
687660tasks. withType(JavaCompile ). configureEach {
0 commit comments