@@ -11,7 +11,6 @@ buildscript {
1111
1212plugins {
1313 id ' java'
14- id " com.vanniktech.maven.publish" version " latest.release"
1514 id ' maven-publish'
1615 id ' signing'
1716
@@ -63,17 +62,16 @@ def getVersion = { boolean considerSnapshot ->
6362 snapshot = " -SNAPSHOT"
6463 }
6564
66- return " ${ major} .${ minor} " +
67- (patch != null ? " .${ patch} " : " " ) +
68- (build != null ? " .${ build} " : " " ) +
69- snapshot
65+ return patch != null
66+ ? " ${ major} .${ minor} .${ patch}${ snapshot} "
67+ : " ${ major} .${ minor}${ snapshot} "
7068}
7169
7270
7371// for publishing a release, call Gradle with Environment Variable RELEASE:
7472// RELEASE=true gradle JSQLParser:publish
7573version = getVersion( ! System . getenv(" RELEASE" ) )
76- group = ' com.manticore-projects.jsqlformatter '
74+ group = ' com.github.jsqlparser '
7775description = ' JSQLParser library'
7876
7977tasks. register(' generateBuildInfo' ) {
@@ -150,16 +148,19 @@ dependencies {
150148 testImplementation ' commons-io:commons-io:2.+'
151149 testImplementation ' org.apache.commons:commons-text:+'
152150 testImplementation ' org.mockito:mockito-core:+'
153- testImplementation ' org.assertj:assertj-core:3. +'
151+ testImplementation ' org.assertj:assertj-core:+'
154152 testImplementation ' org.hamcrest:hamcrest-core:+'
155153 testImplementation ' org.apache.commons:commons-lang3:+'
156154 testImplementation ' com.h2database:h2:+'
157- testImplementation ' org.junit.jupiter:junit-jupiter-api:5.11.4'
158- testImplementation ' org.junit.jupiter:junit-jupiter-params:5.11.4'
159- testImplementation ' org.mockito:mockito-junit-jupiter:5.18.0'
160155
156+ // for JaCoCo Reports
161157 testRuntimeOnly ' org.junit.platform:junit-platform-launcher:1.11.4'
158+ testImplementation ' org.junit.jupiter:junit-jupiter-api:5.11.4'
162159 testRuntimeOnly ' org.junit.jupiter:junit-jupiter-engine:5.11.4'
160+ testImplementation ' org.junit.jupiter:junit-jupiter-params:5.11.4'
161+
162+ // https://mvnrepository.com/artifact/org.mockito/mockito-junit-jupiter
163+ testImplementation ' org.mockito:mockito-junit-jupiter:5.18.0'
163164
164165 // Performance Benchmark
165166 testImplementation ' org.openjdk.jmh:jmh-core:+'
@@ -178,9 +179,11 @@ dependencies {
178179 javacc(' org.javacc.generator:java:8.1.0-SNAPSHOT' ) { changing = true }
179180}
180181configurations. configureEach {
181- // Cache SNAPSHOT/changing modules for javacc for 30 seconds so updates are picked up quickly
182- resolutionStrategy {
183- cacheChangingModulesFor 30 , ' seconds'
182+ resolutionStrategy. eachDependency { DependencyResolveDetails details ->
183+ if (details. requested. group in [' org.javacc:core' , ' org.javacc.generator' ]) {
184+ // Check for updates every build
185+ resolutionStrategy. cacheChangingModulesFor 30 , ' seconds'
186+ }
184187 }
185188}
186189
@@ -196,6 +199,9 @@ compileJavacc {
196199}
197200
198201java {
202+ withSourcesJar()
203+ withJavadocJar()
204+
199205 sourceCompatibility = ' 11'
200206 targetCompatibility = ' 11'
201207
@@ -603,56 +609,89 @@ tasks.register('sphinx', Exec) {
603609 }
604610}
605611
606- mavenPublishing {
607- publishToMavenCentral( true )
608- signAllPublications()
612+ publish {
613+ dependsOn(check, gitChangelogTask, renderRR, xslt, xmldoc )
614+ }
609615
610- coordinates(group, " jsqlparser" , version)
616+ publishing {
617+ publications {
618+ mavenJava(MavenPublication ) {
619+ artifactId = ' jsqlparser'
611620
612- pom {
613- name. set(' JSQLParser library' )
614- description. set(' Parse SQL Statements into Abstract Syntax Trees (AST)' )
615- url. set(' https://github.com/JSQLParser/JSqlParser' )
621+ from components. java
616622
617- licenses {
618- license {
619- name. set(' GNU Library or Lesser General Public License (LGPL) V2.1' )
620- url. set(' http://www.gnu.org/licenses/lgpl-2.1.html' )
621- }
622- license {
623- name. set(' The Apache Software License, Version 2.0' )
624- url. set(' http://www.apache.org/licenses/LICENSE-2.0.txt' )
623+ versionMapping {
624+ usage(' java-api' ) {
625+ fromResolutionOf(' runtimeClasspath' )
626+ }
627+ usage(' java-runtime' ) {
628+ fromResolutionResult()
629+ }
625630 }
626- }
627631
628- developers {
629- developer {
630- id. set(' twa' )
631- name. set(' Tobias Warneke' )
632- email. set(' t.warneke@gmx.net' )
633- }
634- developer {
635- id. set(' are' )
636- name. set(' Andreas Reichel' )
637- email. set(' andreas@manticore-projects.com' )
632+ pom {
633+ name. set(' JSQLParser library' )
634+ description. set(' Parse SQL Statements into Abstract Syntax Trees (AST)' )
635+ url. set(' https://github.com/JSQLParser/JSqlParser' )
636+
637+ licenses {
638+ license {
639+ name. set(' GNU Library or Lesser General Public License (LGPL) V2.1' )
640+ url. set(' http://www.gnu.org/licenses/lgpl-2.1.html' )
641+ }
642+ license {
643+ name. set(' The Apache Software License, Version 2.0' )
644+ url. set(' http://www.apache.org/licenses/LICENSE-2.0.txt' )
645+ }
646+ }
647+
648+ developers {
649+ developer {
650+ id. set(' twa' )
651+ name. set(' Tobias Warneke' )
652+ email. set(' t.warneke@gmx.net' )
653+ }
654+ developer {
655+ id. set(' are' )
656+ name. set(' Andreas Reichel' )
657+ email. set(' andreas@manticore-projects.com' )
658+ }
659+ }
660+
661+ scm {
662+ connection. set(' scm:git:https://github.com/JSQLParser/JSqlParser.git' )
663+ developerConnection. set(' scm:git:ssh://git@github.com:JSQLParser/JSqlParser.git' )
664+ url. set(' https://github.com/JSQLParser/JSqlParser.git' )
665+ }
638666 }
639667 }
668+ }
669+
670+ repositories {
671+ maven {
672+ name = " ossrh"
673+ def releasesRepoUrl = " https://central.sonatype.com/repository/maven-releases"
674+ def snapshotsRepoUrl = " https://central.sonatype.com/repository/maven-snapshots/"
675+ url(version. endsWith(' SNAPSHOT' ) ? snapshotsRepoUrl : releasesRepoUrl)
640676
641- scm {
642- connection . set( ' scm:git:https://github.com/JSQLParser/JSqlParser.git ' )
643- developerConnection . set( ' scm:git:ssh://git@github.com:JSQLParser/JSqlParser.git ' )
644- url . set( ' https://github.com/JSQLParser/JSqlParser.git ' )
677+ credentials {
678+ username = providers . environmentVariable( " ossrhUsername " ) . orNull
679+ password = providers . environmentVariable( " ossrhPassword " ) . orNull
680+ }
645681 }
646682 }
647683}
648684
649- // Fix signing task dependencies
650- tasks. withType(AbstractPublishToMaven ). configureEach {
651- dependsOn(tasks. withType(Sign ))
652- }
653685
654686signing {
655- required { ! version. endsWith(" SNAPSHOT" ) && gradle. taskGraph. hasTask(" publish" ) }
687+ // def signingKey = findProperty("signingKey")
688+ // def signingPassword = findProperty("signingPassword")
689+ // useInMemoryPgpKeys(signingKey, signingPassword)
690+
691+ // don't sign SNAPSHOTS
692+ if (! version. endsWith(' SNAPSHOT' )) {
693+ sign publishing. publications. mavenJava
694+ }
656695}
657696
658697tasks. withType(JavaCompile ). configureEach {
0 commit comments