1- import aQute.bnd.gradle.Bundle
2- import io.github.gradlenexus.publishplugin.NexusRepository
3-
4- buildscript {
5- repositories {
6- mavenCentral()
7- }
8- dependencies {
9- classpath ' biz.aQute.bnd:biz.aQute.bnd.gradle:6.4.0'
10- classpath " org.jfrog.buildinfo:build-info-extractor-gradle:latest.release"
11- }
12- }
131plugins {
14- id ' net.researchgate.release' version ' 3.0.2'
15- id ' com.github.hierynomus.license' version ' 0.16.1'
2+ id ' java-library'
163 id ' maven-publish'
17- id ' signing'
18- id " io.github.gradle-nexus.publish-plugin" version " 1.3.0"
194}
205
21- apply plugin : ' java'
22- apply plugin : ' idea'
23- apply plugin : ' biz.aQute.bnd.builder'
24- apply plugin : ' maven-publish'
25-
26-
276// The upstream project build releases seem to be compiled with Java 11 so keeping compatibility so that our changes can be applied to the upstream project
28- compileJava {
7+ tasks . named( ' compileJava' , JavaCompile ) {
298 options. release = 11
309}
31- compileTestJava {
10+ tasks . named( ' compileTestJava' , JavaCompile ) {
3211 options. release = 11
3312}
3413
35- // custom tasks for creating source/javadoc jars
36- tasks. register(' sourcesJar' , Jar ) {
37- dependsOn classes
38- archiveClassifier = ' sources'
39- from sourceSets. main. allSource
40- }
41-
42- tasks. register(' javadocJar' , Jar ) {
43- dependsOn javadoc
44- archiveClassifier = ' javadoc'
45- from javadoc. destinationDir
46- }
47-
48- release {
49- tagTemplate = ' v${version}'
50- failOnPublishNeeded = false
51- failOnCommitNeeded = false
52- }
53-
5414repositories {
55- mavenCentral()
56- }
57-
58- gradle. projectsEvaluated {
59- tasks. withType(JavaCompile ). tap {
60- configureEach {
61- doLast {
62- options. compilerArgs + = " -parameters"
63- }
15+ maven {
16+ name = ' codeartifact'
17+ url = uri(" $mavenUrl " )
18+ credentials {
19+ username = " $mavenUser "
20+ password = " $mavenPassword "
6421 }
6522 }
6623}
@@ -82,7 +39,9 @@ dependencies {
8239 testImplementation ' org.mockito:mockito-core:2.+'
8340}
8441
85- test. useTestNG()
42+ tasks. named(' test' ) {
43+ useTestNG()
44+ }
8645
8746publishing {
8847 publications {
@@ -92,9 +51,6 @@ publishing {
9251 artifactId project. name
9352 version project. version
9453
95- artifact sourcesJar
96- artifact javadocJar
97-
9854 pom. withXml {
9955 asNode(). children(). last() + {
10056 resolveStrategy = Closure . DELEGATE_FIRST
@@ -154,50 +110,16 @@ publishing {
154110
155111 repositories {
156112 maven {
157- url ' https://repo.nos.to/content/repositories/NostoDependencies/'
113+ name = ' codeartifact'
114+ url = uri(" $mavenUrl " )
158115 credentials {
159- username = project . hasProperty( ' mavenUser ' ) ? project . mavenUser : " "
160- password = project . hasProperty( ' mavenPassword ' ) ? project . mavenPassword : " "
116+ username = " $m avenUser "
117+ password = " $m avenPassword "
161118 }
162119 }
163120 }
164121}
165122
166- tasks. register(' publishToNostoRepo' ) {
167- dependsOn ' publishMavenPublicationToMavenRepository'
168- }
169- gradle. taskGraph. whenReady { taskGraph ->
170- if (taskGraph. hasTask(' :publishToNostoRepo' )) {
171- if (! project. hasProperty(' mavenUser' ) || ! project. hasProperty(' mavenPassword' )) {
172- throw new GradleException (" mavenUser and mavenPassword must be defined for publishToNostoRepo task" )
173- }
174- }
175- }
176-
177-
178- afterReleaseBuild. dependsOn nexusPublishing
179-
180- nexusPublishing {
181- repositories {
182- sonatype {
183- username = System . getenv(" MAVEN_CENTRAL_USERTOKEN_USERNAME" )
184- password = System . getenv(" MAVEN_CENTRAL_USERTOKEN_PASSWORD" )
185- }
186- }
187- }
188-
189- // to publish to local maven repo skip signing: ./gradlew publishToMavenLocal -x signGraphqlJavaPublication
190- signing {
191- required = { ! version. endsWith(" nosto" ) }
192- def signingKey = System . getenv(" MAVEN_CENTRAL_PGP_KEY" )
193- useInMemoryPgpKeys(signingKey, " " )
194- sign publishing. publications
195- }
196-
197- tasks. register(' bundle' , Bundle ) {
198- from sourceSets. main. output
199- }
200-
201123wrapper {
202124 gradleVersion = ' 8.3'
203125}
0 commit comments