Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update release plugin for sonatype #13

Merged
merged 15 commits into from
May 21, 2024
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,30 @@ Goal: "Less Code, Increased Productivity"
Simplistic example: <https://github.com/JabRef/afterburner.fx/tree/main/demo-app>

See also: <http://afterburner.adam-bien.com>


## Release a new version to maven central

Check gpg key and export:
```bash
gpg --list-keys
gpg -K --keyid-format short
gpg --keyring secring.gpg --export-secret-keys > ~/.gnupg/secring.gpg
```

fill out gradle.properties with
```
signing.keyId=<last 8 digits of gpg key (short format) >
signing.password=<gpg key passwrod>
signing.secretKeyRingFile=~/.gnupg/secring.gpg

ossrhUsername=<nexus ossrh username>
ossrhPassword=<nexus ossrh password>
```

When all is set: (Warning: This step cannot be undone!)

```
./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository
```

34 changes: 18 additions & 16 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ plugins {
id 'maven-publish'
id 'signing'
id 'org.openjfx.javafxplugin' version '0.1.0'
id "io.codearte.nexus-staging" version "0.30.0"
id "io.github.gradle-nexus.publish-plugin" version "1.3.0"
}

allprojects {
group = 'org.jabref'
version = '2.0.0-SNAPSHOT'
version = '2.0.0'
koppor marked this conversation as resolved.
Show resolved Hide resolved
ext.isReleaseVersion = !version.endsWith("SNAPSHOT")

repositories {
Expand All @@ -28,7 +28,7 @@ java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17

//withJavadocJar()
withJavadocJar()
withSourcesJar()
}

Expand Down Expand Up @@ -92,12 +92,14 @@ publishing {
def releasesRepoUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
def snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
url = isReleaseVersion ? releasesRepoUrl : snapshotsRepoUrl
println("url $url")

credentials {
username = System.getenv("MAVEN_USERNAME")
password = System.getenv("MAVEN_PASSWORD")
username = ossrhUsername
password = ossrhPassword
}
}
// This currently only works for released versions, as github has problems with overwriting snapshots
/* // This currently only works for released versions, as github has problems with overwriting snapshots
Siedlerchr marked this conversation as resolved.
Show resolved Hide resolved
if (isReleaseVersion) {
maven {
name = "GitHubPackages"
Expand All @@ -107,7 +109,7 @@ publishing {
password = System.getenv("GITHUB_TOKEN")
}
}
}
}*/
}
}

Expand All @@ -116,13 +118,13 @@ signing {
useInMemoryPgpKeys(System.getenv("SIGNING_KEY"), System.getenv("SIGNING_PASSWORD"))
sign publishing.publications.mavenJava
}

nexusStaging {
username = System.getenv("MAVEN_USERNAME")
password = System.getenv("MAVEN_PASSWORD")
nexusPublishing {
repositories {
sonatype { //only for users registered in Sonatype after 24 Feb 2021
username = ossrhUsername
password = ossrhPassword
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
}
}
}

// Don't publish snapshots to Maven Central
closeAndReleaseRepository.onlyIf { isReleaseVersion }
Siedlerchr marked this conversation as resolved.
Show resolved Hide resolved
closeRepository.onlyIf { isReleaseVersion }
releaseRepository.onlyIf { isReleaseVersion }
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public void injectMembers(Object controller, Function<String, Object> injectionC

/**
* Populate the given object.
* For example, set all fields annotated with {@link javax.inject.Inject}.
* For example, set all fields annotated with {@link jakarta.inject.Inject}.
*
* @param instance the object to inject members into
* @param injectionContext a cache of already instantiated and initialized instances
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,7 @@ static ResourceLocator discover() {
/**
* This method method replaces the standard afterburner dependency
* injection.
*
* @param <T> the type of the presenter
* @param clazz presenter class containing the default constructor.
* @param injectionContext a cache of already instantiated and initialized
* instances.
* @param name The name of the bundle
* @return a fully initialized presenter with injected dependencies.
*/
ResourceBundle getResourceBundle(String name);
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/airhacks/afterburner/views/ViewLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ private static ExecutorService getExecutorService() {
/**
* Sets the given class as controller.
*
* @implNote We don't use {@link FXMLLoader#setController(Object)} since then the {@code fx:controller} attribute
* We don't use {@link FXMLLoader#setController(Object)} since then the {@code fx:controller} attribute
* is no longer allowed in the fxml file and we loose IDE support.
*/
public ViewLoader controller(Object root) {
Expand Down Expand Up @@ -141,8 +141,8 @@ public ViewLoader inject(Function<String, Object> injectionContext) {

/**
* Sets the root of the object hierarchy. The value passed to this method
* is used as the value of the {@link <fx:root>} tag. This method
* must be called prior to loading the document when using {@link <fx:root>}.
* is used as the value of the {@code <fx:root>} tag. This method
* must be called prior to loading the document when using {@code <fx:root>}.
*
* @param root the object used as the root
*/
Expand Down