From e8192f7b5eda33065101c1a5e73fada77b49b041 Mon Sep 17 00:00:00 2001 From: Mattias Reichel Date: Mon, 4 Nov 2024 08:33:51 +0100 Subject: [PATCH] Remove `-plain` suffix from Grails Plugin artifacts (#347) * fix: Remove '-plain' suffix from plugin jar artifacts * chore: Update license header of changed file --- .../core/GrailsPluginGradlePlugin.groovy | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/main/groovy/org/grails/gradle/plugin/core/GrailsPluginGradlePlugin.groovy b/src/main/groovy/org/grails/gradle/plugin/core/GrailsPluginGradlePlugin.groovy index 9299c1a5..0bce211e 100644 --- a/src/main/groovy/org/grails/gradle/plugin/core/GrailsPluginGradlePlugin.groovy +++ b/src/main/groovy/org/grails/gradle/plugin/core/GrailsPluginGradlePlugin.groovy @@ -1,11 +1,11 @@ /* - * Copyright 2015 original authors + * Copyright 2015-2024 original authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -36,6 +36,7 @@ import org.gradle.api.tasks.compile.GroovyCompile import org.gradle.language.jvm.tasks.ProcessResources import org.gradle.tooling.provider.model.ToolingModelBuilderRegistry import org.grails.gradle.plugin.util.SourceSets +import org.springframework.boot.gradle.plugin.SpringBootPlugin import org.springframework.boot.gradle.tasks.bundling.BootJar import javax.inject.Inject @@ -186,13 +187,14 @@ class GrailsPluginGradlePlugin extends GrailsGradlePlugin { } protected void configurePluginJarTask(Project project) { - Jar jarTask = (Jar)project.tasks.findByName('jar') - // re-enable, since Boot disable this - project.getTasks().getByName(JavaPlugin.JAR_TASK_NAME).setEnabled(true) - jarTask.exclude "application.yml" - jarTask.exclude "application.groovy" - jarTask.exclude "logback.groovy" - jarTask.exclude "logback.xml" + project.tasks.named(SpringBootPlugin.BOOT_JAR_TASK_NAME) { + it.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') + } } @CompileDynamic