Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure Grails plugin assemble task produces only a JAR artifact #369

Merged
merged 3 commits into from
Dec 26, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import org.gradle.api.tasks.TaskContainer
import org.gradle.api.tasks.TaskDependency
import org.gradle.api.tasks.bundling.Jar
import org.gradle.api.tasks.compile.GroovyCompile
import org.gradle.language.base.plugins.LifecycleBasePlugin
import org.gradle.language.jvm.tasks.ProcessResources
import org.gradle.tooling.provider.model.ToolingModelBuilderRegistry
import org.grails.gradle.plugin.util.SourceSets
Expand Down Expand Up @@ -187,13 +188,16 @@ class GrailsPluginGradlePlugin extends GrailsGradlePlugin {
}

protected void configurePluginJarTask(Project project) {
project.tasks.named(SpringBootPlugin.BOOT_JAR_TASK_NAME) {
it.enabled = false // Grails Plugins should not produce a bootJar
project.tasks.named(SpringBootPlugin.BOOT_JAR_TASK_NAME) { Task bootJarTask ->
bootJarTask.enabled = false // Grails Plugins should not produce a bootJar
}
project.tasks.named(JavaPlugin.JAR_TASK_NAME, Jar) {
it.enabled = true
it.archiveClassifier.set('') // Remove '-plain' suffix from jar file name
it.exclude('application.yml', 'application.groovy', 'logback.groovy', 'logback.xml')
project.tasks.named(JavaPlugin.JAR_TASK_NAME, Jar) { Jar jarTask ->
jarTask.enabled = true
jarTask.archiveClassifier.set('') // Remove '-plain' suffix from jar file name
jarTask.exclude('application.yml', 'application.groovy', 'logback.groovy', 'logback.xml')
}
project.tasks.named(LifecycleBasePlugin.ASSEMBLE_TASK_NAME) { Task assembleTask ->
assembleTask.dependsOn(JavaPlugin.JAR_TASK_NAME) // assemble task should produce the jar artifact
}
}

Expand Down
Loading