Skip to content
This repository was archived by the owner on Nov 29, 2021. It is now read-only.

Commit 81f612d

Browse files
committed
Migrated to Maven Central for publishing
1 parent 61116a7 commit 81f612d

File tree

4 files changed

+101
-52
lines changed

4 files changed

+101
-52
lines changed

.buildkite/pipeline.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,10 @@ steps:
2727

2828
- label: ':rocket: publish'
2929
<<: *if-release
30-
key: bintray-publish
30+
key: mavencentral-publish
3131
agents:
3232
java: 11
3333
commands:
3434
- git fetch --tags
35-
- ./gradlew bintrayPublish bintrayUpload --console plain
35+
- ./gradlew publishReleasePublicationToMavenCentralRepository --console plain
36+

build.gradle

Lines changed: 19 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ plugins {
33
id 'java-library'
44
id 'io.freefair.lombok' version '5.1.1'
55
id 'maven-publish'
6-
id 'com.jfrog.bintray' version '1.8.4'
6+
id 'signing'
77
id 'io.spring.dependency-management' version '1.0.10.RELEASE'
88
id 'com.github.jk1.dependency-license-report' version '1.14'
99
id 'org.sonarqube' version '3.1.1'
@@ -13,23 +13,13 @@ plugins {
1313
apply plugin: 'io.freefair.lombok'
1414
apply plugin: 'idea'
1515

16-
repositories {
17-
mavenCentral()
18-
}
19-
2016
group = 'engineering.everest.starterkit'
2117
sourceCompatibility = '1.11'
22-
version = gitVersion()
23-
24-
test {
25-
useJUnitPlatform()
26-
}
2718

28-
lombok {
29-
version = '1.18.16'
30-
generateLombokConfig.enabled = false
31-
config['lombok.addLombokGeneratedAnnotation'] = 'true'
32-
}
19+
def gitTagVersion = versionDetails()
20+
version = gitTagVersion.commitDistance == 0
21+
? gitTagVersion.lastTag
22+
: "${gitTagVersion.lastTag}+${gitTagVersion.commitDistance}-SNAPSHOT"
3323

3424
ext {
3525
springBootVersion = '2.4.0'
@@ -58,47 +48,26 @@ dependencies {
5848
testImplementation "org.springframework.security:spring-security-test"
5949
}
6050

61-
bintray {
62-
user = System.getenv('BINTRAY_USER')
63-
key = System.getenv('BINTRAY_KEY')
64-
publications = ['maven']
65-
pkg {
66-
repo = 'starterkit'
67-
name = rootProject.name
68-
userOrg = 'everestengineering'
69-
licenses = ['Apache-2.0']
70-
vcsUrl = 'https://github.com/everestengineering/starterkit-security'
51+
java {
52+
java {
53+
withJavadocJar()
54+
withSourcesJar()
7155
}
72-
publish = true
7356
}
7457

75-
publishing {
76-
publications {
77-
maven(MavenPublication) {
78-
from components.java
79-
}
80-
}
58+
repositories {
59+
mavenCentral()
8160
}
8261

83-
jacocoTestReport {
84-
reports {
85-
xml.enabled true
86-
csv.enabled false
87-
html.enabled true
88-
}
62+
test {
63+
useJUnitPlatform()
8964
}
9065

91-
test.finalizedBy jacocoTestReport
92-
93-
sonarqube {
94-
properties {
95-
property "sonar.projectName", "Lhotse - security"
96-
property "sonar.projectKey", "everest-engineering_lhotse-security"
97-
property "sonar.organization", "everestengineering"
98-
property "sonar.host.url", "https://sonarcloud.io"
99-
property 'sonar.test.exclusions', '**/*Test.java'
100-
}
66+
lombok {
67+
version = '1.18.16'
68+
generateLombokConfig.enabled = false
69+
config['lombok.addLombokGeneratedAnnotation'] = 'true'
10170
}
10271

103-
tasks['sonarqube'].dependsOn test
104-
72+
apply from: 'publishing.gradle'
73+
apply from: 'sonar.gradle'

publishing.gradle

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
publishing {
2+
publications {
3+
release(MavenPublication) {
4+
from components.java
5+
6+
pom {
7+
name = 'lhotse-security'
8+
description = 'This is a supporting library for Lhotse, a starter kit for writing event sourced web applications following domain driven design principles.'
9+
url = 'https://github.com/everest-engineering/lhotse-security'
10+
licenses {
11+
license {
12+
name = 'The Apache License, Version 2.0'
13+
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
14+
}
15+
}
16+
developers {
17+
developer {
18+
id = 'everest-engineering'
19+
name = 'EverestEngineering'
20+
email = 'hi@everest.engineering'
21+
}
22+
}
23+
scm {
24+
connection = 'https://github.com/everest-engineering/lhotse-security.git'
25+
developerConnection = 'https://github.com/everest-engineering/lhotse-security.git'
26+
url = 'https://github.com/everest-engineering/lhotse-security'
27+
}
28+
}
29+
}
30+
}
31+
repositories {
32+
maven {
33+
name = "MavenCentral"
34+
def ossrhUsername = System.getenv('OSSRH_USERNAME')
35+
def ossrhPassword = System.getenv('OSSRH_PASSWORD')
36+
def releasesRepoUrl = 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/'
37+
def snapshotsRepoUrl = 'https://s01.oss.sonatype.org/content/repositories/snapshots/'
38+
url = version.contains('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
39+
40+
credentials {
41+
username = "${ossrhUsername}"
42+
password = "${ossrhPassword}"
43+
}
44+
}
45+
}
46+
}
47+
48+
signing {
49+
def signingPassword = System.getenv('SIGNING_PASSWORD')
50+
def signingKey = System.getenv('SIGNING_KEY')
51+
useInMemoryPgpKeys(signingKey, signingPassword)
52+
sign publishing.publications.release
53+
}
54+
55+
javadoc {
56+
if (JavaVersion.current().isJava9Compatible()) {
57+
options.addBooleanOption('html5', true)
58+
}
59+
}

sonar.gradle

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
jacocoTestReport {
2+
reports {
3+
xml.enabled true
4+
html.enabled true
5+
}
6+
}
7+
8+
test.finalizedBy jacocoTestReport
9+
10+
sonarqube {
11+
properties {
12+
property 'sonar.projectName', 'Lhotse - security'
13+
property 'sonar.projectKey', 'everest-engineering_lhotse-security'
14+
property 'sonar.organization', 'everestengineering'
15+
property 'sonar.host.url', 'https://sonarcloud.io'
16+
property 'sonar.test.exclusions', '**/*Test.java'
17+
}
18+
}
19+
20+
tasks['sonarqube'].dependsOn test

0 commit comments

Comments
 (0)