Skip to content

Instantly share code, notes, and snippets.

@wreulicke
Last active March 24, 2025 01:31
Show Gist options
  • Save wreulicke/3746ae81569ba06271ab95582b358a64 to your computer and use it in GitHub Desktop.
Save wreulicke/3746ae81569ba06271ab95582b358a64 to your computer and use it in GitHub Desktop.
依存をrelocateするやつ + relocateしたやつでテストするやつ
tasks.named('shadowJar').configure {
dependsOn tasks.named('classes')
from sourceSets.main.runtimeClasspath.find { it.name.startsWith('hogehoge') }
archiveBaseName.set("hogehoge")
archiveClassifier.set("relocated")
relocate 'some.package', 'relocated.some.package'
dependencies {
exclude({ true })
}
}
tasks.named('test') {
dependsOn tasks.named('shadowJar')
def filteredClasspath = sourceSets.test.runtimeClasspath.filter {
!it.name.startsWith('hoge')
}
classpath = filteredClasspath + tasks.named('shadowJar').get().outputs.files
// Use JUnit Platform for unit tests.
useJUnitPlatform()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment