From cc4d2ca6f77d08d1ae7f24ea340e175f6aecd6f6 Mon Sep 17 00:00:00 2001 From: Kyle Winkelman Date: Thu, 11 Jan 2024 08:51:51 -0600 Subject: [PATCH 1/7] Make gradlew executable. --- gradlew | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 gradlew diff --git a/gradlew b/gradlew old mode 100644 new mode 100755 From 396150b32c3ea148e6d9d12b463d01c8ef05e830 Mon Sep 17 00:00:00 2001 From: Kyle Winkelman Date: Thu, 11 Jan 2024 08:58:45 -0600 Subject: [PATCH 2/7] Shadow WireMock dependency to reduce shadow jar size. --- ...emock.tools.gradle.wiremock-extension-convention.gradle | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/main/groovy/org.wiremock.tools.gradle.wiremock-extension-convention.gradle b/src/main/groovy/org.wiremock.tools.gradle.wiremock-extension-convention.gradle index a818665..d66fbb4 100644 --- a/src/main/groovy/org.wiremock.tools.gradle.wiremock-extension-convention.gradle +++ b/src/main/groovy/org.wiremock.tools.gradle.wiremock-extension-convention.gradle @@ -19,7 +19,6 @@ wrapper { project.ext { versions = [ wiremock : '3.3.1', - handlebars: '4.3.1', junit : '5.10.1', assertj : '3.24.2', restAssured: '5.3.2', @@ -204,11 +203,9 @@ repositories { } dependencies { - implementation("org.wiremock:wiremock:${versions.wiremock}") - implementation("com.github.jknack:handlebars-helpers:${versions.handlebars}") { - exclude group: 'org.mozilla', module: 'rhino' - } + shadow("org.wiremock:wiremock:${versions.wiremock}") + testImplementation("org.wiremock:wiremock:${versions.wiremock}") testImplementation(platform("org.junit:junit-bom:${versions.junit}")) testImplementation('org.junit.jupiter:junit-jupiter') testImplementation("org.assertj:assertj-core:${versions.assertj}") From e441917a031d0f0a12158f850baeec2271f678ba Mon Sep 17 00:00:00 2001 From: Kyle Winkelman Date: Thu, 11 Jan 2024 09:14:09 -0600 Subject: [PATCH 3/7] Relocate packages in the same way core WireMock does. --- ...radle.wiremock-extension-convention.gradle | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/main/groovy/org.wiremock.tools.gradle.wiremock-extension-convention.gradle b/src/main/groovy/org.wiremock.tools.gradle.wiremock-extension-convention.gradle index d66fbb4..bf7db2f 100644 --- a/src/main/groovy/org.wiremock.tools.gradle.wiremock-extension-convention.gradle +++ b/src/main/groovy/org.wiremock.tools.gradle.wiremock-extension-convention.gradle @@ -49,6 +49,34 @@ shadowJar { project.configurations.standaloneOnly ] + relocate 'org.mortbay', 'wiremock.org.mortbay' + relocate 'org.eclipse', 'wiremock.org.eclipse' + relocate 'org.codehaus', 'wiremock.org.codehaus' + relocate 'com.google', 'wiremock.com.google' + relocate 'com.google.thirdparty', 'wiremock.com.google.thirdparty' + relocate 'com.fasterxml.jackson', 'wiremock.com.fasterxml.jackson' + relocate 'org.apache', 'wiremock.org.apache' + relocate 'org.xmlunit', 'wiremock.org.xmlunit' + relocate 'org.hamcrest', 'wiremock.org.hamcrest' + relocate 'org.skyscreamer', 'wiremock.org.skyscreamer' + relocate 'org.json', 'wiremock.org.json' + relocate 'net.minidev', 'wiremock.net.minidev' + relocate 'com.jayway', 'wiremock.com.jayway' + relocate 'org.objectweb', 'wiremock.org.objectweb' + relocate 'org.custommonkey', 'wiremock.org.custommonkey' + relocate 'net.javacrumbs', 'wiremock.net.javacrumbs' + relocate 'net.sf', 'wiremock.net.sf' + relocate 'com.github.jknack', 'wiremock.com.github.jknack' + relocate 'org.antlr', 'wiremock.org.antlr' + relocate 'jakarta.servlet', 'wiremock.jakarta.servlet' + relocate 'org.checkerframework', 'wiremock.org.checkerframework' + relocate 'org.hamcrest', 'wiremock.org.hamcrest' + relocate 'org.slf4j', 'wiremock.org.slf4j' + relocate 'joptsimple', 'wiremock.joptsimple' + relocate 'org.yaml', 'wiremock.org.yaml' + relocate 'com.ethlo', 'wiremock.com.ethlo' + relocate 'com.networknt', 'wiremock.com.networknt' + with copySpec { from("shadowjar/resources") {} } From 104d1334b771d8281a82fd1359576a91f047f81a Mon Sep 17 00:00:00 2001 From: Kyle Winkelman Date: Thu, 11 Jan 2024 09:42:59 -0600 Subject: [PATCH 4/7] Remove unnecessary exclusions/inclusions. --- ...tools.gradle.wiremock-extension-convention.gradle | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/main/groovy/org.wiremock.tools.gradle.wiremock-extension-convention.gradle b/src/main/groovy/org.wiremock.tools.gradle.wiremock-extension-convention.gradle index bf7db2f..3b4ae0f 100644 --- a/src/main/groovy/org.wiremock.tools.gradle.wiremock-extension-convention.gradle +++ b/src/main/groovy/org.wiremock.tools.gradle.wiremock-extension-convention.gradle @@ -77,19 +77,7 @@ shadowJar { relocate 'com.ethlo', 'wiremock.com.ethlo' relocate 'com.networknt', 'wiremock.com.networknt' - with copySpec { - from("shadowjar/resources") {} - } - - dependencies { - exclude(dependency('junit:junit')) - } - mergeServiceFiles() - - exclude 'META-INF/maven/**' - exclude 'module-info.class' - exclude 'handlebars-*.js' // Comes from WirerMock } signing { From 471ffa0b203fbc20fed14a610144cf82fbdf9508 Mon Sep 17 00:00:00 2001 From: Kyle Winkelman Date: Thu, 11 Jan 2024 09:45:39 -0600 Subject: [PATCH 5/7] Allow normal jar to register services. --- ...rg.wiremock.tools.gradle.wiremock-extension-convention.gradle | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/groovy/org.wiremock.tools.gradle.wiremock-extension-convention.gradle b/src/main/groovy/org.wiremock.tools.gradle.wiremock-extension-convention.gradle index 3b4ae0f..ec70e0e 100644 --- a/src/main/groovy/org.wiremock.tools.gradle.wiremock-extension-convention.gradle +++ b/src/main/groovy/org.wiremock.tools.gradle.wiremock-extension-convention.gradle @@ -38,7 +38,6 @@ java { jar { archiveBaseName.set("${baseArtifact}") - exclude 'META-INF/services' } shadowJar { From 6987ac3474ef3db1cb58dc3fb10197640d15598f Mon Sep 17 00:00:00 2001 From: Kyle Winkelman Date: Fri, 12 Jan 2024 11:00:30 -0600 Subject: [PATCH 6/7] TestContainers use for testing standalone jar. --- ...ock.tools.gradle.wiremock-extension-convention.gradle | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/groovy/org.wiremock.tools.gradle.wiremock-extension-convention.gradle b/src/main/groovy/org.wiremock.tools.gradle.wiremock-extension-convention.gradle index ec70e0e..cbc5757 100644 --- a/src/main/groovy/org.wiremock.tools.gradle.wiremock-extension-convention.gradle +++ b/src/main/groovy/org.wiremock.tools.gradle.wiremock-extension-convention.gradle @@ -22,7 +22,9 @@ project.ext { junit : '5.10.1', assertj : '3.24.2', restAssured: '5.3.2', - awaitility: '4.2.0' + awaitility: '4.2.0', + testcontainers: '1.19.3', + wiremockTestcontainers: '1.0-alpha-13' ] } @@ -225,8 +227,10 @@ dependencies { testImplementation('org.junit.jupiter:junit-jupiter') testImplementation("org.assertj:assertj-core:${versions.assertj}") testImplementation(platform("io.rest-assured:rest-assured-bom:${versions.restAssured}")) - testImplementation("io.rest-assured:rest-assured") + testImplementation('io.rest-assured:rest-assured') testImplementation("org.awaitility:awaitility:${versions.awaitility}") + testImplementation("org.testcontainers:junit-jupiter:${versions.testcontainers}") + testImplementation("org.wiremock.integrations.testcontainers:wiremock-testcontainers-module:${versions.wiremockTestcontainers}") } @@ -241,6 +245,7 @@ compileTestJava { options.encoding = 'UTF-8' } assemble.dependsOn jar, shadowJar +test.dependsOn shadowJar test { useJUnitPlatform() From c308bbe32f79f5dbe94a4ab9eaf5e038706279c9 Mon Sep 17 00:00:00 2001 From: Kyle Winkelman Date: Fri, 12 Jan 2024 11:07:38 -0600 Subject: [PATCH 7/7] Fix gradle deprecation warning. --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index 64cc7e7..d844622 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -76,7 +76,7 @@ val wiremockVersion = "3.3.1" val basePackagePath = "org/wiremock/tools/gradle/plugins" val processResources by tasks.existing(ProcessResources::class) val writeDefaultVersionsProperties by tasks.registering(WriteProperties::class) { - outputFile = processResources.get().destinationDir.resolve("$basePackagePath/default-versions.properties") + destinationFile.set(processResources.get().destinationDir.resolve("$basePackagePath/default-versions.properties")) property("wiremock_version", wiremockVersion) } processResources {