Skip to content

Commit

Permalink
GROOVY-11190: Jakarta EE 9 compatibility for groovy-servlet (add java…
Browse files Browse the repository at this point in the history
…x classifier for backwards compatibility)
  • Loading branch information
paulk-asert committed Jan 5, 2025
1 parent 08a398e commit 306ba36
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions subprojects/groovy-servlet/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import org.apache.groovy.gradle.JarJarTask

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
Expand Down Expand Up @@ -37,3 +39,27 @@ dependencies {
testImplementation projects.groovyJson
testImplementation projects.groovyTest
}

tasks.register("javaxJar", JarJarTask) {
def jarjar = tasks.named("jarjar", JarJarTask)
it.dependsOn(jarjar)
it.from.set(jarjar.flatMap { it.outputFile })
it.patterns = [
'jakarta.servlet.**': 'javax.servlet.@1'
]
it.createManifest = false
it.outputFile.set(layout.buildDirectory.file(
tasks.named('jar', Jar).map { jar ->
"libs/${jar.archiveBaseName.get()}-${jar.archiveVersion.get()}-javax.jar"
}
))
}

afterEvaluate {
def javaxJarTask = tasks.javaxJar
def mavenPublish = extensions.findByName(PublishingExtension.NAME) as PublishingExtension
mavenPublish?.publications.each {
it.artifact(javaxJarTask.outputs.files.singleFile) { classifier = "javax" }
}
tasks.matching { it.group == PublishingExtension.NAME }.configureEach { dependsOn(javaxJarTask) }
}

0 comments on commit 306ba36

Please sign in to comment.