Skip to content

Commit

Permalink
Merge pull request #12 from kyle-winkelman/shadow
Browse files Browse the repository at this point in the history
Improve creation of standalone jar.
  • Loading branch information
oleg-nenashev authored Mar 7, 2024
2 parents 842ebc3 + c308bbe commit acc230b
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 20 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Empty file modified gradlew
100644 → 100755
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ wrapper {
project.ext {
versions = [
wiremock : '3.3.1',
handlebars: '4.3.1',
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'
]
}

Expand All @@ -39,7 +40,6 @@ java {

jar {
archiveBaseName.set("${baseArtifact}")
exclude 'META-INF/services'
}

shadowJar {
Expand All @@ -50,19 +50,35 @@ shadowJar {
project.configurations.standaloneOnly
]

with copySpec {
from("shadowjar/resources") {}
}

dependencies {
exclude(dependency('junit:junit'))
}
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'

mergeServiceFiles()

exclude 'META-INF/maven/**'
exclude 'module-info.class'
exclude 'handlebars-*.js' // Comes from WirerMock
}

signing {
Expand Down Expand Up @@ -204,17 +220,17 @@ 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}")
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}")
}


Expand All @@ -229,6 +245,7 @@ compileTestJava {
options.encoding = 'UTF-8'
}
assemble.dependsOn jar, shadowJar
test.dependsOn shadowJar

test {
useJUnitPlatform()
Expand Down

0 comments on commit acc230b

Please sign in to comment.