17
17
* A note about publishing and signing.
18
18
* Maven central requires that artifacts be signed. And upload is done to Sonatype.
19
19
* To publish you will need these environment variables defined:
20
- * SONATYPE_TOKEN_USERNAME
21
- * SONATYPE_TOKEN_PASSWORD
22
20
* MAVEN_GPG_PRIVATE_KEY
23
21
* MAVEN_GPG_PASSPHRASE
24
22
* Suggestion is to put these in a shell script with restricted read permissions, then source it before calling
@@ -37,11 +35,11 @@ plugins {
37
35
38
36
// Setup and configure properties that are consistent across all projects, including sub-modules.
39
37
allprojects {
40
- group ' io.github.jcpitre. gtfs-validator-trial '
38
+ group ' org.mobilitydata. gtfs-validator'
41
39
42
40
// Per the axion-release plugin, this computes the project version based
43
41
// on the most recent tag in the repo.
44
- version 1.3
42
+ version " 0.3 "
45
43
46
44
repositories {
47
45
mavenCentral()
@@ -59,6 +57,7 @@ allprojects {
59
57
60
58
tasks. withType(Javadoc ) {
61
59
options. encoding = ' UTF-8'
60
+ options. addStringOption(' Xdoclint:none' , ' -quiet' )
62
61
}
63
62
64
63
// All projects that include the 'java` plugin will have a Test task by default.
@@ -83,16 +82,6 @@ subprojects {
83
82
apply plugin : ' java'
84
83
apply plugin : libs. plugins. spotless. get(). pluginId
85
84
86
- // Cannot publish a SNAPSHOT. The provided sonatype url will not accept it.
87
- tasks. withType(PublishToMavenRepository ). all { task ->
88
- task. onlyIf {
89
- if (project. version. toString(). contains(' SNAPSHOT' )) {
90
- throw new GradleException (" Publishing is not allowed for SNAPSHOT versions. Currently " + project. version)
91
- }
92
- true
93
- }
94
- }
95
-
96
85
task javadocJar(type : Jar ) {
97
86
archiveClassifier. set(' javadoc' )
98
87
from javadoc
@@ -126,12 +115,15 @@ subprojects {
126
115
// Once successfully closed, the repo is available for testing.
127
116
// After testing, it can be manually promoted on the sonatype site, which will then publish to maven central.
128
117
maven {
129
- url = " ${ buildDir} /local-repo"
130
- // url = 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2'
131
- // credentials {
132
- // username System.getenv("SONATYPE_TOKEN_USERNAME")
133
- // password System.getenv("SONATYPE_TOKEN_PASSWORD")
134
- // }
118
+ if (version. endsWith(' SNAPSHOT' )) {
119
+ url = ' https://central.sonatype.com/repository/maven-snapshots/'
120
+ credentials {
121
+ username = System . getenv(" MAVEN_CENTRAL_PORTAL_TOKEN_USERNAME" )
122
+ password = System . getenv(" MAVEN_CENTRAL_PORTAL_TOKEN_PASSWORD" )
123
+ }
124
+ } else {
125
+ url = " ${ buildDir} /local-repo"
126
+ }
135
127
}
136
128
}
137
129
@@ -174,16 +166,33 @@ subprojects {
174
166
useInMemoryPgpKeys(System . getenv(' MAVEN_GPG_PRIVATE_KEY' ), System . getenv(' MAVEN_GPG_PASSPHRASE' ))
175
167
sign publishing. publications. mavenJava
176
168
}
169
+
170
+
171
+ // tasks.named('publish') {
172
+ // finalizedBy customPublish
173
+ // }
177
174
}
178
175
task customPublish {
179
- dependsOn publish
176
+ // dependsOn publishMavenJavaPublicationToMavenRepository
177
+ // mustRunAfter publish
178
+ onlyIf {
179
+ if (project. version. toString(). contains(' SNAPSHOT' )) {
180
+ throw new GradleException (" Publishing to Maven Central Portal is not allowed for SNAPSHOT versions. Currently " + project. version)
181
+ }
182
+ return true
183
+ }
184
+
180
185
doLast {
181
186
exec {
187
+ println " Current working directory: ${ project.file('.').absolutePath} "
182
188
commandLine ' bash' , " ../scripts/custom_publish.sh" , project. name, project. version
183
189
}
184
190
}
185
191
}
192
+
193
+
186
194
}
195
+
187
196
compileJava {
188
197
options. compilerArgs << ' -parameters'
189
198
}
0 commit comments