1
1
plugins {
2
2
id ' com.diffplug.spotless' version ' 6.25.0' apply false
3
3
id ' org.kordamp.gradle.jandex' version ' 2.1.0' apply false
4
- id ' io.github.gradle-nexus.publish-plugin ' version ' 2.0 .0'
4
+ id ' org.jreleaser ' version ' 1.19 .0'
5
5
id ' net.researchgate.release' version ' 3.1.0'
6
6
}
7
7
@@ -10,27 +10,17 @@ wrapper {
10
10
}
11
11
12
12
String groupId = ' org.gitlab4j'
13
+ group = groupId
13
14
15
+ def repositoryPath = ' build/staging-deploy'
14
16
subprojects {
15
17
apply plugin : ' java-library'
16
- apply plugin : ' signing'
17
18
apply plugin : ' com.diffplug.spotless'
18
19
apply plugin : ' maven-publish'
19
20
apply plugin : ' org.kordamp.gradle.jandex'
20
21
21
22
group = groupId
22
23
23
- signing {
24
- useGpgCmd()
25
- sign(publishing. publications)
26
- }
27
-
28
- tasks. withType(Sign ) {
29
- onlyIf {
30
- project. hasProperty(' signing.gnupg.keyName' )
31
- }
32
- }
33
-
34
24
java {
35
25
withJavadocJar()
36
26
withSourcesJar()
@@ -61,21 +51,74 @@ subprojects {
61
51
tasks. named(" javadoc" ) {
62
52
inputs. files(tasks. getByPath(" jandex" ). outputs. files)
63
53
}
54
+
55
+ publishing {
56
+ repositories {
57
+ maven {
58
+ url = rootProject. file(repositoryPath)
59
+ }
60
+ }
61
+ }
64
62
}
65
63
66
- nexusPublishing {
67
- packageGroup = ' org.gitlab4j'
68
- repositories {
69
- sonatype {
70
- nexusUrl. set(uri(" https://oss.sonatype.org/service/local/" ))
71
- username = project. findProperty(' ossSonatypeUsername' ) ?: ' '
72
- password = project. findProperty(' ossSonatypePassword' ) ?: ' '
64
+ jreleaser {
65
+ signing {
66
+ active = ' RELEASE'
67
+ armored = true
68
+ }
69
+ deploy {
70
+ maven {
71
+ mavenCentral {
72
+ gitlab4j {
73
+ active = ' RELEASE'
74
+ namespace = ' org.gitlab4j'
75
+ url = ' https://central.sonatype.com/api/v1/publisher'
76
+ stagingRepository(repositoryPath)
77
+ retryDelay = 30
78
+ maxRetries = 150
79
+ }
80
+ }
81
+ }
82
+ }
83
+ release {
84
+ github {
85
+ enabled = true
86
+ repoOwner = " $githubRepositoryOwner "
87
+ name = " $githubRepositoryName "
88
+ tagName = ' {{projectVersion}}'
89
+ overwrite = true
90
+ skipTag = true
91
+ releaseNotes {
92
+ enabled = true
93
+ }
94
+ changelog {
95
+ enabled = false
96
+ }
97
+ milestone {
98
+ close = true
99
+ }
100
+ issues {
101
+ enabled = true
102
+ comment = ' This issue has been resolved in `{{tagName}}` ([Release Notes]({{releaseNotesUrl}}))'
103
+ applyMilestone = ' ALWAYS'
104
+
105
+ label {
106
+ name = ' released'
107
+ color = ' #FF0000'
108
+ description = ' Issue has been released'
109
+ }
110
+ }
73
111
}
74
112
}
75
113
}
76
114
77
115
release {
78
- buildTasks = [' doRelease' ]
116
+ buildTasks = [
117
+ ' checkLastVersionValue' ,
118
+ ' clean' ,
119
+ ' publish' ,
120
+ ' jreleaserDeploy'
121
+ ]
79
122
git {
80
123
requireBranch. set(' main' )
81
124
}
@@ -107,25 +150,8 @@ def updateLastVersionValueTask = tasks.register('updateLastVersionValue') {
107
150
}
108
151
}
109
152
110
- task doRelease {
111
- dependsOn(
112
- checkLastVersionValueTask,
113
- ' initializeSonatypeStagingRepository' ,
114
- ' clean' ,
115
- ' build'
116
- )
117
- }
118
-
119
153
model {
120
154
tasks. unSnapshotVersion {
121
155
dependsOn updateLastVersionValueTask
122
156
}
123
157
}
124
- // dependency on 'publishToSonatype' must be added in a 'afterEvaluate' block, see https://github.com/gradle/gradle/issues/16543#issuecomment-2529428010
125
- afterEvaluate {
126
- model {
127
- tasks. doRelease {
128
- dependsOn project. getTasksByName(' publishToSonatype' , true )
129
- }
130
- }
131
- }
0 commit comments