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

Feature/migrate maven publish #26

Merged
merged 4 commits into from
Jun 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Scenarioo Writer API for Java to generate Scenarioo Documentations - http://www.
## Usage
Scenarioo-Java is available on maven central: Include the latest version as a dependency in your favorite
dependency management system:
`compile 'org.scenarioo:scenarioo-java:3.0.0'`
`implementation 'org.scenarioo:scenarioo-java:3.0.0'`

Notice that at least Java 8 is required for version 3.0.0 of the writer library

Expand Down
98 changes: 51 additions & 47 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ version = '3.0.0-SNAPSHOT'

apply plugin: 'eclipse'
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'signing'

sourceCompatibility = 1.8
Expand All @@ -37,17 +37,17 @@ repositories {
}

dependencies {
compile 'org.apache.commons:commons-lang3:3.0.1'
compile 'commons-io:commons-io:1.3.2'
compile 'commons-codec:commons-codec:1.2'
compile 'log4j:log4j:1.2.17'
testCompile 'org.junit.jupiter:junit-jupiter-api:5.3.2'
testRuntime 'org.junit.jupiter:junit-jupiter-engine:5.3.2'
implementation 'org.apache.commons:commons-lang3:3.0.1'
implementation 'commons-io:commons-io:1.3.2'
implementation 'commons-codec:commons-codec:1.2'
implementation 'log4j:log4j:1.2.17'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.3.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.3.2'

//These libraries are no longer provided in Java 9+, thus we need to add them manually
compile 'javax.xml.bind:jaxb-api:2.3.1'
compile 'com.sun.xml.bind:jaxb-core:2.3.0.1'
compile 'com.sun.xml.bind:jaxb-impl:2.3.2'
implementation 'javax.xml.bind:jaxb-api:2.3.1'
implementation 'com.sun.xml.bind:jaxb-core:2.3.0.1'
implementation 'com.sun.xml.bind:jaxb-impl:2.3.2'
}

test {
Expand All @@ -64,70 +64,74 @@ task javadocJar(type: Jar) {
}

task sourcesJar(type: Jar) {
archiveClassifier.set('javadoc')
archiveClassifier.set('sources')
from sourceSets.main.allSource
}

artifacts {
archives javadocJar, sourcesJar
}

if (project.hasProperty('sign')) {
signing {
sign configurations.archives
}
}

tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}

uploadArchives {
repositories {
mavenDeployer {
if (project.hasProperty('sign')) {
beforeDeployment {
MavenDeployment deployment -> signing.signPom(deployment)
}
}

repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}

snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact sourcesJar
artifact javadocJar

pom.project {
name 'Scenarioo java'
packaging 'jar'
description 'Scenarioo Writer library for Java to generate Scenarioo Documentation http://www.scenarioo.org'
url 'http://www.scenarioo.org'
pom {
name = 'Scenarioo Java'
packaging = 'jar'
description = 'Scenarioo Writer library for Java to generate Scenarioo Documentation http://www.scenarioo.org'
url = 'http://www.scenarioo.org'

scm {
connection 'https://github.com/scenarioo/scenarioo-java.git'
developerConnection 'https://github.com/scenarioo/scenarioo-java.git'
url 'https://github.com/scenarioo/scenarioo-java.git'
connection = 'https://github.com/scenarioo/scenarioo-java.git'
developerConnection = 'https://github.com/scenarioo/scenarioo-java.git'
url = 'https://github.com/scenarioo/scenarioo-java.git'
}

licenses {
license {
name 'GNU GENERAL PUBLIC LICENCE with linking exception'
url 'https://github.com/scenarioo/scenarioo-java/blob/develop/LICENSE.txt'
name = 'GNU GENERAL PUBLIC LICENCE with linking exception'
url = 'https://github.com/scenarioo/scenarioo-java/blob/develop/LICENSE.txt'
}
}

developers {
developer {
id 'scenarioo'
name 'Scenarioo'
email 'contact@scenarioo.org'
id = 'scenarioo'
name = 'Scenarioo'
email = 'contact@scenarioo.org'
}
}
}
}
}

repositories {
maven {
if (version.contains("SNAPSHOT")) {
url "https://oss.sonatype.org/content/repositories/snapshots/"
} else {
url "https://oss.sonatype.org/service/local/staging/deploy/maven2"
}
credentials {
username ossrhUsername
password ossrhPassword
}
}
}
}

if (ossrhPassword) {
signing {
sign publishing.publications.mavenJava
}
}

task generateSchema(type: JavaExec) {
Expand All @@ -139,7 +143,7 @@ jar.dependsOn generateSchema

wrapper {
distributionType = Wrapper.DistributionType.ALL
gradleVersion = "5.6"
gradleVersion = "6.7.1"
}


22 changes: 13 additions & 9 deletions docs/upload-to-maven-central.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,22 @@

## Snapshot

1. You will need to specify the following properties in your `gradle.properties` located in your gradle home directory:
1. You will need to specify the following properties in your `gradle.properties` located in your gradle home directory:

```
signing.keyId=BDCAAE60
signing.password=#private key goes here#
signing.secretKeyRingFile=#secret key file goes here#
ossrhUsername=scenarioo
ossrhPassword=#sonatype password goes here#
```
The credentials can be found in the internal MS Teams Channel.

```
signing.keyId=BDCAAE60
signing.password=#private key goes here#
signing.secretKeyRingFile=#secret key file goes here#
ossrhUsername=scenarioo
ossrhPassword=#sonatype password goes here#
```

2. Change the version appropriately in the `build.gradle`
3. `gradlew clean uploadArchives -Psign`
3. `gradlew clean publish`
4. Promote build to maven central: http://central.sonatype.org/pages/releasing-the-deployment.html
Please note, we're using the old server https://oss.sonatype.org.

## Releases

Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists