Skip to content

Commit f1eb1c1

Browse files
authored
Deployment to Maven Central SNAPSHOT (#3819)
2 parents a17b5ce + fdc8e57 commit f1eb1c1

3 files changed

Lines changed: 93 additions & 136 deletions

File tree

.github/workflows/nightlydeploy.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ jobs:
2424
java-version: ${{ env.JAVA_VERSION }}
2525
distribution: 'temurin'
2626
cache: 'gradle'
27-
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
28-
gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }}
2927

3028
- name: Setup Gradle
3129
uses: gradle/actions/setup-gradle@v6
@@ -57,6 +55,7 @@ jobs:
5755
run: |
5856
gh release delete nightly --yes --cleanup-tag
5957
58+
6059
- name: Create nightly release
6160
id: create_release
6261
env:
@@ -66,13 +65,14 @@ jobs:
6665
--prerelease --notes-start-tag KEY-2.12.3 \
6766
nightly key.ui/build/libs/key-*-exe.jar key-javadoc.tar.xz
6867
69-
- run: export GPG_TTY=$(tty)
70-
- name: Upload to SNAPSHOT repository
71-
run: ./gradlew --parallel publishMavenJavaPublicationToKEYLABRepository
68+
69+
- name: Upload to MAVEN CENTRAL SNAPSHOT repository
70+
run: |
71+
./gradlew publishAndReleaseToMavenCentral publishMavenPublicationToKEYLABRepository
7272
env:
7373
BUILD_NUMBER: "SNAPSHOT"
7474
GITLAB_DEPLOY_TOKEN: ${{ secrets.GITLAB_DEPLOY_TOKEN }}
75-
# SIGNING_KEY_ID: ${{secrents.SIGNING_KEY_ID}}
76-
# GPG_PRIVATE_KEY: ${{secrents.GPG_PRIVATE_KEY}}
77-
# GPG_PASSPHRASE: ${{secrents.GPG_PASSPHRASE}}
78-
75+
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{secrets.GPG_PRIVATE_KEY}}
76+
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{secrets.GPG_PASSPHRASE}}
77+
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USERNAME }}
78+
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }}

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# KeY -- Deductive Java Program Verifier
22

3-
[![Tests](https://github.com/KeYProject/key/actions/workflows/tests.yml/badge.svg)](https://github.com/KeYProject/key/actions/workflows/tests.yml) [![CodeQL](https://github.com/KeYProject/key/actions/workflows/codeql.yml/badge.svg)](https://github.com/KeYProject/key/actions/workflows/codeql.yml) [![CodeQuality](https://github.com/KeYProject/key/actions/workflows/code_quality.yml/badge.svg)](https://github.com/KeYProject/key/actions/workflows/code_quality.yml)
3+
[![Tests](https://github.com/KeYProject/key/actions/workflows/tests.yml/badge.svg)](https://github.com/KeYProject/key/actions/workflows/tests.yml) [![CodeQuality](https://github.com/KeYProject/key/actions/workflows/code_quality.yml/badge.svg)](https://github.com/KeYProject/key/actions/workflows/code_quality.yml)
4+
5+
![Maven metadata URL](https://img.shields.io/maven-metadata/v?metadataUrl=https%3A%2F%2Fcentral.sonatype.com%2Frepository%2Fmaven-snapshots%2Forg%2Fkey-project%2Fkey.core%2Fmaven-metadata.xml&label=maven%20snapshots)
6+
![Maven metadata URL](https://img.shields.io/maven-metadata/v?metadataUrl=https%3A%2F%2Frepo1.maven.org%2Fmaven2%2Forg%2Fkey-project%2Fkey.core%2Fmaven-metadata.xml&label=maven%20central)
7+
48

59
This repository is the home of the interactive theorem prover KeY for formal verification and analysis of Java programs. KeY comes as a standalone GUI application, which allows you to verify the functional correctness of Java programs with respect to formal specifications formulated in the Java Modeling Language JML. Moreover, KeY can also be used as a library e.g. for symbolic program execution, first order reasoning, or test case generation.
610

@@ -113,7 +117,7 @@ This is the KeY project - Integrated Deductive Software Design
113117
Copyright (C) 2001-2011 Universität Karlsruhe, Germany
114118
Universität Koblenz-Landau, Germany
115119
and Chalmers University of Technology, Sweden
116-
Copyright (C) 2011-2024 Karlsruhe Institute of Technology, Germany
120+
Copyright (C) 2011-2026 Karlsruhe Institute of Technology, Germany
117121
Technical University Darmstadt, Germany
118122
Chalmers University of Technology, Sweden
119123

build.gradle

Lines changed: 78 additions & 125 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
import com.vanniktech.maven.publish.JavaLibrary
2+
import com.vanniktech.maven.publish.JavadocJar
3+
import com.vanniktech.maven.publish.SourcesJar
4+
15
plugins {
26
//Support for IntelliJ IDEA
37
//https://docs.gradle.org/current/userguide/idea_plugin.html
@@ -14,9 +18,7 @@ plugins {
1418
id "org.checkerframework" version "0.6.61"
1519

1620
// Plugin for publishing via the new Nexus API
17-
id "io.github.gradle-nexus.publish-plugin" version "2.0.0"
18-
19-
id "signing"
21+
id "com.vanniktech.maven.publish" version "0.36.0" apply false
2022
}
2123

2224

@@ -41,13 +43,13 @@ version = "3.0.0$build"
4143
subprojects {
4244
apply plugin: "java"
4345
apply plugin: "java-library"
44-
apply plugin: "maven-publish"
45-
apply plugin: "signing" // GPG signing of artifacts, required by maven central
4646
apply plugin: "idea"
4747
apply plugin: "eclipse"
4848

4949
apply plugin: "com.diffplug.spotless"
5050
apply plugin: "org.checkerframework"
51+
apply plugin: "com.vanniktech.maven.publish"
52+
//apply plugin: "maven-publish"
5153

5254
group = rootProject.group
5355
version = rootProject.version
@@ -81,13 +83,13 @@ subprojects {
8183
testImplementation("ch.qos.logback:logback-classic:1.5.32")
8284

8385
testImplementation(platform("org.junit:junit-bom:6.0.3"))
84-
testImplementation ("org.junit.jupiter:junit-jupiter-api")
85-
testImplementation ("org.junit.jupiter:junit-jupiter-params")
86-
testRuntimeOnly ("org.junit.jupiter:junit-jupiter-engine")
87-
testRuntimeOnly ("org.junit.platform:junit-platform-launcher")
88-
testImplementation ("org.assertj:assertj-core:3.27.7")
89-
testImplementation (project(':key.util'))
90-
testImplementation (testFixtures(project(":key.util")))
86+
testImplementation("org.junit.jupiter:junit-jupiter-api")
87+
testImplementation("org.junit.jupiter:junit-jupiter-params")
88+
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
89+
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
90+
testImplementation("org.assertj:assertj-core:3.27.7")
91+
testImplementation(project(':key.util'))
92+
testImplementation(testFixtures(project(":key.util")))
9193

9294
// test fixtures
9395
testImplementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.21.3")
@@ -135,7 +137,6 @@ subprojects {
135137
classpath = sourceSets.test.runtimeClasspath
136138
}
137139

138-
139140
test {
140141
// Before we switched to JUnit 5, we used JUnit 4 with a customized discovery of test class.
141142
// This discovery called AutoSuite and searched in the compiled classes. AutoSuite was
@@ -148,10 +149,10 @@ subprojects {
148149
}
149150

150151
addTestListener(new TestListener() {
151-
void afterTest(TestDescriptor desc, TestResult result) {
152-
logger.error("${result.getResultType()}: ${desc.getClassName()}#${desc.getName()}")
153-
}
154-
})
152+
void afterTest(TestDescriptor desc, TestResult result) {
153+
logger.error("${result.getResultType()}: ${desc.getClassName()}#${desc.getName()}")
154+
}
155+
})
155156

156157
addTestListener(new TestListener() {
157158
void beforeTest(TestDescriptor descriptor) {
@@ -284,130 +285,82 @@ subprojects {
284285
// specific delimiter: normally just 'package', but spotless crashes for files in default package
285286
// (see https://github.com/diffplug/spotless/issues/30), therefore 'import' is needed. '//' is for files
286287
// with completely commented out code (which would probably better just be removed in future).
287-
if (project.name == 'recoder') {
288-
licenseHeaderFile("$rootDir/gradle/header-recoder", '(package|import|//)')
289-
} else {
290-
licenseHeaderFile("$rootDir/gradle/header", '(package|import|//)')
291-
}
288+
licenseHeaderFile("$rootDir/gradle/header", '(package|import|//)')
292289
}
293290
}
294291

295-
afterEvaluate { // required so project.description is non-null as set by sub build.gradle
296-
publishing {
297-
publications {
298-
mavenJava(MavenPublication) {
299-
from components.java
300-
artifact sourcesJar
301-
artifact javadocJar
302-
pom {
303-
name = projects.name
304-
description = project.description
305-
url = 'https://key-project.org/'
306-
307-
licenses {
308-
license {
309-
name = "GNU General Public License (GPL), Version 2"
310-
url = "https://www.gnu.org/licenses/old-licenses/gpl-2.0.html"
311-
}
312-
}
313-
314-
developers {
315-
developer {
316-
id = 'key'
317-
name = 'KeY Developers'
318-
email = 'support@key-project.org'
319-
url = "https://www.key-project.org/about/people/"
320-
}
321-
}
322-
scm {
323-
connection = 'scm:git:git://github.com/keyproject/key.git'
324-
developerConnection = 'scm:git:git://github.com/keyproject/key.git'
325-
url = 'https://github.com/keyproject/key/'
326-
}
327-
}
292+
mavenPublishing {
293+
publishToMavenCentral()
294+
signAllPublications()
295+
296+
configure(new JavaLibrary(
297+
new JavadocJar.Javadoc(),
298+
new SourcesJar.Sources()
299+
))
300+
301+
pom {
302+
name = project.name
303+
description = project.description
304+
url = 'https://key-project.org/'
305+
306+
licenses {
307+
license {
308+
name = "GNU General Public License (GPL), Version 2"
309+
url = "https://www.gnu.org/licenses/old-licenses/gpl-2.0.html"
328310
}
329311
}
330-
repositories {
331-
maven {
332-
name = "LOCAL"
333-
url= uri("$rootDir/local")
334-
}
335312

336-
maven { // deployment to git.key-project.org/key-public/key
337-
name = "KEYLAB"
338-
url = uri("https://git.key-project.org/api/v4/projects/35/packages/maven")
339-
credentials(HttpHeaderCredentials) {
340-
def userToken = envOrPropertyValue("GITLAB_USER_TOKEN")
341-
def deployToken = envOrPropertyValue("GITLAB_DEPLOY_TOKEN")
342-
def ciToken = envOrPropertyValue("GITLAB_CIJOB_TOKEN")
343-
344-
if (userToken != "") {
345-
name = 'Private-Token'
346-
value = userToken
347-
} else if(deployToken != "") {
348-
name = 'Deploy-Token'
349-
value = deployToken
350-
} else {
351-
name = 'Job-Token'
352-
value = ciToken
353-
}
354-
}
355-
authentication {
356-
header(HttpHeaderAuthentication)
357-
}
313+
developers {
314+
developer {
315+
id = 'key'
316+
name = 'KeY Developers'
317+
email = 'support@key-project.org'
318+
url = "https://www.key-project.org/about/people/"
358319
}
359320
}
360-
}
361-
signing {
362-
//sign publishing.publications.mavenJava
321+
scm {
322+
connection = 'scm:git:git://github.com/keyproject/key.git'
323+
developerConnection = 'scm:git:git://github.com/keyproject/key.git'
324+
url = 'https://github.com/keyproject/key/'
325+
}
363326
}
364327
}
365-
}
366328

367-
signing {
368-
// does not work
369-
if(System.getenv("GPG_PRIVATE_KEY") == null) {
370-
useGpgCmd() // works better than the Java implementation, which requires PGP keyrings.
371-
} else{
372-
useInMemoryPgpKeys(
373-
System.getenv("SIGNING_KEY_ID"),
374-
System.getenv("GPG_PRIVATE_KEY"),
375-
System.getenv("GPG_PASSPHRASE")
376-
)
377-
}
378-
}
329+
publishing {
330+
repositories {
331+
maven {
332+
name = "LOCAL"
333+
url= uri("$rootDir/local")
334+
}
379335

380-
nexusPublishing {
381-
repositories {
382-
central {
383-
nexusUrl = uri("https://ossrh-staging-api.central.sonatype.com/service/local/")
384-
snapshotRepositoryUrl = uri("https://central.sonatype.com/repository/maven-snapshots/")
385-
386-
stagingProfileId.set("org.key-project")
387-
388-
/**
389-
* To be able to publish things on Maven Central, you need two things:
390-
*
391-
* (1) a JIRA account with permission on group-id `org.key-project`
392-
* (2) a keyserver-published GPG (w/o sub-keys)
393-
*
394-
* Your `$HOME/.gradle/gradle.properties` should like this:
395-
* ```
396-
* signing.keyId=YourKeyId
397-
* signing.password=YourPublicKeyPassword
398-
* ossrhUsername=your-jira-id
399-
* ossrhPassword=your-jira-password
400-
* ```
401-
*
402-
* You can test signing with `gradle sign`, and publish with `gradle publish`.
403-
* https://central.sonatype.org/publish/publish-guide/
404-
*/
405-
username = envOrPropertyValue("ossrhUsername")
406-
password = envOrPropertyValue("ossrhPassword")
336+
maven { // deployment to git.key-project.org/key-public/key
337+
name = "KEYLAB"
338+
url = uri("https://git.key-project.org/api/v4/projects/35/packages/maven")
339+
credentials(HttpHeaderCredentials) {
340+
def userToken = envOrPropertyValue("GITLAB_USER_TOKEN")
341+
def deployToken = envOrPropertyValue("GITLAB_DEPLOY_TOKEN")
342+
def ciToken = envOrPropertyValue("GITLAB_CIJOB_TOKEN")
343+
344+
if (userToken != "") {
345+
name = 'Private-Token'
346+
value = userToken
347+
} else if(deployToken != "") {
348+
name = 'Deploy-Token'
349+
value = deployToken
350+
} else {
351+
name = 'Job-Token'
352+
value = ciToken
353+
}
354+
}
355+
authentication {
356+
header(HttpHeaderAuthentication)
357+
}
358+
}
407359
}
408360
}
409361
}
410362

363+
411364
tasks.register('start'){
412365
description = "Use :key.ui:run instead"
413366
doFirst {

0 commit comments

Comments
 (0)