Skip to content

Commit e3c047e

Browse files
committed
Prepare for deploying to Maven
- Remove org.testcontainers BOM and declare version of org.testcontainers:jdbc explicitly, as previous solution resulted in versionless org.testcontainers:jdbc dependency in POM - Change declaration from implementation to api for org.testcontainers:jdbc dependency so correct scope is applied in POM
1 parent 0572867 commit e3c047e

3 files changed

Lines changed: 115 additions & 2 deletions

File tree

build.gradle

Lines changed: 81 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
plugins {
22
id 'java-library'
3+
id 'nu.studer.credentials' version '1.0.7'
4+
id 'maven'
5+
id 'signing'
36
}
47

58
group 'org.firebirdsql'
@@ -12,15 +15,18 @@ ext {
1215
testContainersVersion = '1.11.3'
1316
lombokVersion = '1.18.8'
1417
jaybirdVersion = '3.0.6'
18+
19+
isReleaseVersion = !version.endsWith("SNAPSHOT")
20+
set("signing.password", credentials."signing.password")
21+
ossrhPassword = credentials.ossrhPassword
1522
}
1623

1724
repositories {
1825
mavenCentral()
1926
}
2027

2128
dependencies {
22-
implementation platform("org.testcontainers:testcontainers-bom:$testContainersVersion")
23-
implementation 'org.testcontainers:jdbc'
29+
api "org.testcontainers:jdbc:$testContainersVersion"
2430

2531
annotationProcessor "org.projectlombok:lombok:$lombokVersion"
2632
compileOnly "org.projectlombok:lombok:$lombokVersion"
@@ -32,3 +38,76 @@ dependencies {
3238
testImplementation 'commons-dbutils:commons-dbutils:1.6'
3339
testImplementation 'com.zaxxer:HikariCP:3.3.1'
3440
}
41+
42+
jar {
43+
manifest {
44+
attributes(
45+
'Implementation-Title': project.name,
46+
'Implementation-Version': project.version,
47+
'Automatic-Module-Name': 'org.firebirdsql.testcontainers'
48+
)
49+
}
50+
}
51+
52+
task javadocJar(type: Jar) {
53+
archiveClassifier = 'javadoc'
54+
from javadoc
55+
}
56+
57+
task sourcesJar(type: Jar) {
58+
archiveClassifier = 'sources'
59+
from sourceSets.main.allSource
60+
}
61+
62+
artifacts {
63+
archives javadocJar, sourcesJar
64+
}
65+
66+
signing {
67+
required { isReleaseVersion && gradle.taskGraph.hasTask("uploadArchives") }
68+
sign configurations.archives
69+
}
70+
71+
uploadArchives {
72+
repositories {
73+
mavenDeployer {
74+
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
75+
76+
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
77+
authentication(userName: ossrhUsername, password: ossrhPassword)
78+
}
79+
80+
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
81+
authentication(userName: ossrhUsername, password: ossrhPassword)
82+
}
83+
84+
pom.project {
85+
name 'firebird-testcontainers-java'
86+
packaging 'jar'
87+
description 'A module for Testcontainers.org to provide lightweight, throwaway instances of Firebird for JUnit tests.'
88+
url 'https://github.com/FirebirdSQL/firebird-testcontainers-java'
89+
90+
scm {
91+
connection 'scm:git:https://github.com/FirebirdSQL/firebird-testcontainers-java.git'
92+
developerConnection 'scm:git:git@github.com:FirebirdSQL/firebird-testcontainers-java.git'
93+
url 'https://github.com/FirebirdSQL/firebird-testcontainers-java'
94+
}
95+
96+
licenses {
97+
license {
98+
name 'The MIT License'
99+
url 'https://opensource.org/licenses/MIT'
100+
}
101+
}
102+
103+
developers {
104+
developer {
105+
id 'mrotteveel'
106+
name 'Mark Rotteveel'
107+
email 'mark@lawinegevaar.nl'
108+
}
109+
}
110+
}
111+
}
112+
}
113+
}

devdoc/deploy.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
Deploying
2+
=========
3+
4+
To deploy to Maven use
5+
6+
```
7+
gradlew clean uploadArchives -PcredentialsPassphrase=<credentials password>
8+
```
9+
10+
Where `<credentials password>` is the password used to add the credentials (see
11+
also below).
12+
13+
To be able to deploy, you need the following:
14+
15+
a `<homedir>/.gradle/gradle.properties` with the following properties:
16+
17+
```
18+
signing.keyId=<gpg key id>
19+
signing.secretKeyRingFile=<path to your secring.gpg>
20+
21+
ossrhUsername=<sonatype OSSRH username>
22+
```
23+
24+
In addition, you need to set the following credentials
25+
26+
```
27+
./gradlew addCredentials --key signing.password --value <your secret key password> -PcredentialsPassphrase=<credentials password>
28+
./gradlew addCredentials --key ossrhPassword --value <your sonatyp OSSRH password> -PcredentialsPassphrase=<credentials password>
29+
```
30+
31+
See https://github.com/etiennestuder/gradle-credentials-plugin for details on
32+
credentials.

gradle.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Default value so the build script doesn't break
2+
ossrhUsername=don't break the build

0 commit comments

Comments
 (0)