diff --git a/.sdkmanrc b/.sdkmanrc new file mode 100644 index 00000000..215786fc --- /dev/null +++ b/.sdkmanrc @@ -0,0 +1 @@ +java=17.0.12-librca 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 9c98b0ff..cd2a05d3 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 @@ -192,13 +193,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