-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
repair POM generation using afterEvaluate
- Loading branch information
Showing
1 changed file
with
97 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -277,102 +277,6 @@ subprojects { | |
archiveClassifier = 'javadoc' | ||
} | ||
|
||
publishing { | ||
publications { | ||
mavenJava(MavenPublication) { | ||
from components.java | ||
artifact sourcesJar | ||
artifact javadocJar | ||
pom { | ||
name = projects.name | ||
description = project.description | ||
url = 'https://key-project.org/' | ||
|
||
licenses { | ||
license { | ||
name = "GNU General Public License (GPL), Version 2" | ||
url = "https://www.gnu.org/licenses/old-licenses/gpl-2.0.html" | ||
} | ||
} | ||
|
||
developers { | ||
developer { | ||
id = 'key' | ||
name = 'KeY Developers' | ||
email = '[email protected]' | ||
url = "https://www.key-project.org/about/people/" | ||
} | ||
} | ||
scm { | ||
connection = 'scm:git:git://github.com/keyproject/key.git' | ||
developerConnection = 'scm:git:git://github.com/keyproject/key.git' | ||
url = 'https://github.com/keyproject/key/' | ||
} | ||
} | ||
} | ||
} | ||
repositories { | ||
maven { | ||
/** | ||
* To be able to publish things on Maven Central, you need two things: | ||
* | ||
* (1) a JIRA account with permission on group-id `org.key-project` | ||
* (2) a keyserver-published GPG (w/o sub-keys) | ||
* | ||
* Your `$HOME/.gradle/gradle.properties` should like this: | ||
* ``` | ||
* signing.keyId=YourKeyId | ||
* signing.password=YourPublicKeyPassword | ||
* ossrhUsername=your-jira-id | ||
* ossrhPassword=your-jira-password | ||
* ``` | ||
* | ||
* You can test signing with `gradle sign`, and publish with `gradle publish`. | ||
* https://central.sonatype.org/publish/publish-guide/ | ||
*/ | ||
if (project.version.endsWith("-SNAPSHOT")) { | ||
name = "mavenSnapshot" | ||
url = "https://s01.oss.sonatype.org/content/repositories/snapshots/" | ||
credentials(PasswordCredentials) { | ||
username = project.properties.getOrDefault("ossrhUsername","") | ||
password = project.properties.getOrDefault("ossrhPassword","") | ||
} | ||
} else { | ||
name = "mavenStaging" | ||
url = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/" | ||
credentials(PasswordCredentials) { | ||
username = project.properties.getOrDefault("ossrhUsername","") | ||
password = project.properties.getOrDefault("ossrhPassword","") | ||
} | ||
} | ||
} | ||
|
||
/* | ||
maven { // deployment to git.key-project.org | ||
name = "GitlabPackages" | ||
url "https://git.key-project.org/api/v4/projects/35/packages/maven" | ||
credentials(HttpHeaderCredentials) { | ||
if (System.getenv("TOKEN") != null) { | ||
name = 'Private-Token' | ||
value = System.getenv("TOKEN") | ||
} else { | ||
name = 'Job-Token' | ||
value = System.getenv("CI_JOB_TOKEN") | ||
} | ||
} | ||
authentication { | ||
header(HttpHeaderAuthentication) | ||
} | ||
} | ||
*/ | ||
} | ||
} | ||
|
||
signing { | ||
useGpgCmd() // works better than the Java implementation, which requires PGP keyrings. | ||
sign publishing.publications.mavenJava | ||
} | ||
|
||
license {//configures the license file header | ||
header = file("$rootDir/gradle/header") | ||
|
||
|
@@ -397,8 +301,6 @@ subprojects { | |
} | ||
} | ||
|
||
|
||
|
||
spotless { | ||
// see https://github.com/diffplug/spotless/tree/main/plugin-gradle | ||
|
||
|
@@ -452,6 +354,103 @@ subprojects { | |
} | ||
} | ||
|
||
afterEvaluate { // required so project.description is non-null as set by sub build.gradle | ||
publishing { | ||
publications { | ||
mavenJava(MavenPublication) { | ||
from components.java | ||
artifact sourcesJar | ||
artifact javadocJar | ||
pom { | ||
name = projects.name | ||
description = project.description | ||
url = 'https://key-project.org/' | ||
|
||
licenses { | ||
license { | ||
name = "GNU General Public License (GPL), Version 2" | ||
url = "https://www.gnu.org/licenses/old-licenses/gpl-2.0.html" | ||
} | ||
} | ||
|
||
developers { | ||
developer { | ||
id = 'key' | ||
name = 'KeY Developers' | ||
email = '[email protected]' | ||
url = "https://www.key-project.org/about/people/" | ||
} | ||
} | ||
scm { | ||
connection = 'scm:git:git://github.com/keyproject/key.git' | ||
developerConnection = 'scm:git:git://github.com/keyproject/key.git' | ||
url = 'https://github.com/keyproject/key/' | ||
} | ||
} | ||
} | ||
} | ||
repositories { | ||
maven { | ||
/** | ||
* To be able to publish things on Maven Central, you need two things: | ||
* | ||
* (1) a JIRA account with permission on group-id `org.key-project` | ||
* (2) a keyserver-published GPG (w/o sub-keys) | ||
* | ||
* Your `$HOME/.gradle/gradle.properties` should like this: | ||
* ``` | ||
* signing.keyId=YourKeyId | ||
* signing.password=YourPublicKeyPassword | ||
* ossrhUsername=your-jira-id | ||
* ossrhPassword=your-jira-password | ||
* ``` | ||
* | ||
* You can test signing with `gradle sign`, and publish with `gradle publish`. | ||
* https://central.sonatype.org/publish/publish-guide/ | ||
*/ | ||
if (project.version.endsWith("-SNAPSHOT")) { | ||
name = "mavenSnapshot" | ||
url = "https://s01.oss.sonatype.org/content/repositories/snapshots/" | ||
credentials(PasswordCredentials) { | ||
username = project.properties.getOrDefault("ossrhUsername", "") | ||
password = project.properties.getOrDefault("ossrhPassword", "") | ||
} | ||
} else { | ||
name = "mavenStaging" | ||
url = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/" | ||
credentials(PasswordCredentials) { | ||
username = project.properties.getOrDefault("ossrhUsername", "") | ||
password = project.properties.getOrDefault("ossrhPassword", "") | ||
} | ||
} | ||
} | ||
|
||
/* | ||
maven { // deployment to git.key-project.org | ||
name = "GitlabPackages" | ||
url "https://git.key-project.org/api/v4/projects/35/packages/maven" | ||
credentials(HttpHeaderCredentials) { | ||
if (System.getenv("TOKEN") != null) { | ||
name = 'Private-Token' | ||
value = System.getenv("TOKEN") | ||
} else { | ||
name = 'Job-Token' | ||
value = System.getenv("CI_JOB_TOKEN") | ||
} | ||
} | ||
authentication { | ||
header(HttpHeaderAuthentication) | ||
} | ||
} | ||
*/ | ||
} | ||
} | ||
|
||
signing { | ||
useGpgCmd() // works better than the Java implementation, which requires PGP keyrings. | ||
sign publishing.publications.mavenJava | ||
} | ||
} | ||
} | ||
|
||
task start { | ||
|