Skip to content

Commit d56f3db

Browse files
authored
Merge pull request #31 from wiremock/wiremock-4-upgrade
upgrade to wiremock 4 and new maven central publishing.
2 parents 3035433 + 0e2e9eb commit d56f3db

6 files changed

Lines changed: 20 additions & 34 deletions

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Features:
1313
## Requirements
1414

1515
- Gradle 8.x
16-
- Java 11 or 17
16+
- Java 17
1717

1818
## WireMock dependency
1919

@@ -22,6 +22,7 @@ in your plugin, this plugin needs to be updated accordingly:
2222

2323
| Gradle Convention plugin version | Wiremock version |
2424
|----------------------------------|------------------|
25+
| 0.6.0+ | 4.0.0 |
2526
| 0.4.0+ | 3.10.0 |
2627
| 0.3.0+ | 3.6.0 |
2728
| 0.1.0+ | 3.3.1 |
@@ -125,7 +126,7 @@ jobs:
125126
- name: Set up Java
126127
uses: actions/setup-java@v3
127128
with:
128-
java-version: '11'
129+
java-version: '17'
129130
distribution: 'adopt'
130131
- name: Validate Gradle wrapper
131132
uses: gradle/wrapper-validation-action@v1
@@ -140,11 +141,11 @@ jobs:
140141
id: publish_package
141142
uses: gradle/gradle-build-action@v2.9.0
142143
with:
143-
arguments: -Pversion=${{ steps.new_version.outputs.new_version }} publish closeAndReleaseStagingRepository
144+
arguments: -Pversion=${{ steps.new_version.outputs.new_version }} publishAndReleaseToMavenCentral --no-configuration-cache
144145
env:
145146
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
146-
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
147-
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
147+
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ vars.MAVEN_CENTRAL_USERNAME }}
148+
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
148149
OSSRH_GPG_SECRET_KEY: ${{ secrets.OSSRH_GPG_SECRET_KEY }}
149150
OSSRH_GPG_SECRET_KEY_PASSWORD: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }}
150151
```

build.gradle.kts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ plugins {
1111
id("com.gradle.plugin-publish") version "1.3.1"
1212
id("com.palantir.git-version") version "4.0.0" apply false
1313
id("com.github.johnrengelman.shadow") version "8.1.1" apply false
14-
id("io.github.gradle-nexus.publish-plugin") version "2.0.0" apply false
14+
id("com.vanniktech.maven.publish.base") version "0.35.0" apply false
1515
id("com.github.ben-manes.versions") version "0.52.0"
1616
}
1717

1818
group = "org.wiremock.tools.gradle"
1919

2020
java {
2121
toolchain {
22-
languageVersion.set(JavaLanguageVersion.of(11))
22+
languageVersion.set(JavaLanguageVersion.of(17))
2323
}
2424
}
2525

@@ -77,7 +77,7 @@ dependencies {
7777
implementation(kotlin("stdlib-jdk8"))
7878
implementation("com.palantir.gradle.gitversion:gradle-git-version:4.0.0")
7979
implementation("com.github.johnrengelman:shadow:8.1.1")
80-
implementation("io.github.gradle-nexus:publish-plugin:2.0.0")
80+
implementation("com.vanniktech.maven.publish.base:com.vanniktech.maven.publish.base.gradle.plugin:0.35.0")
8181

8282
runtimeOnly(kotlin("gradle-plugin"))
8383

@@ -101,7 +101,7 @@ tasks {
101101

102102
// default versions ---------------------------------------------------
103103

104-
val wiremockVersion = "3.10.0"
104+
val wiremockVersion = "4.0.0-beta.19"
105105

106106
val basePackagePath = "org/wiremock/tools/gradle/plugins"
107107
val processResources by tasks.existing(ProcessResources::class)

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version=0.5.1
1+
version=0.6.0-beta.1

src/main/groovy/org.wiremock.tools.gradle.extension-dependencies.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
project.ext {
22
versions = [
3-
wiremock : '3.10.0',
3+
wiremock : '4.0.0-beta.19',
44
junit : '5.10.1',
55
assertj : '3.24.2',
66
restAssured: '5.3.2',

src/main/groovy/org.wiremock.tools.gradle.java.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ repositories {
2222
mavenLocal()
2323
}
2424

25-
sourceCompatibility = 11
26-
targetCompatibility = 11
25+
sourceCompatibility = 17
26+
targetCompatibility = 17
2727

2828
compileJava {
2929
options.encoding = 'UTF-8'
@@ -44,7 +44,7 @@ test {
4444

4545
idea {
4646
project {
47-
jdkName = '11'
48-
languageLevel = '11'
47+
jdkName = '17'
48+
languageLevel = '17'
4949
}
5050
}

src/main/groovy/org.wiremock.tools.gradle.publishing.gradle

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@ def getGivenConfigConventional() {
88
logger.info("WireMock conventions given config: ${getGivenConfigConventional()}")
99

1010
project.plugins.apply 'signing'
11-
project.plugins.apply 'maven-publish'
1211
if (getGivenConfigConventional().useShadowJar) {
1312
project.plugins.apply "com.github.johnrengelman.shadow"
1413
}
15-
project.plugins.apply 'io.github.gradle-nexus.publish-plugin'
14+
project.plugins.apply 'com.vanniktech.maven.publish.base'
1615

1716
if (getGivenConfigConventional().useShadowJar) {
1817
assemble.dependsOn shadowJar
@@ -201,20 +200,6 @@ tasks.withType(AbstractPublishToMaven).configureEach {
201200
mustRunAfter(signingTasks)
202201
}
203202

204-
nexusPublishing {
205-
// See https://github.com/wiremock/community/blob/main/infra/maven-central.md
206-
repositories {
207-
sonatype {
208-
// TODO: allow configuring destinations for oss1
209-
// nexusUrl.set(uri("https://oss.sonatype.org/service/local/"))
210-
// snapshotRepositoryUrl.set(uri("https://oss.sonatype.org/content/repositories/snapshots/"))
211-
nexusUrl = uri("https://ossrh-staging-api.central.sonatype.com/service/local/")
212-
def envUsername = providers.environmentVariable("OSSRH_USERNAME").orElse("").get()
213-
def envPassword = providers.environmentVariable("OSSRH_TOKEN").orElse("").get()
214-
if (!envUsername.isEmpty() && !envPassword.isEmpty()) {
215-
username.set(envUsername)
216-
password.set(envPassword)
217-
}
218-
}
219-
}
220-
}
203+
mavenPublishing {
204+
publishToMavenCentral()
205+
}

0 commit comments

Comments
 (0)