Skip to content

Commit 5cc50ee

Browse files
committed
grails.build.info should go in WEB-INF/classes/META-INF for WAR files. Fixes #9978
1 parent cad0e80 commit 5cc50ee

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

grails-gradle-plugin/src/main/groovy/org/grails/gradle/plugin/core/GrailsGradlePlugin.groovy

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,10 @@ class GrailsGradlePlugin extends GroovyPlugin {
156156
}
157157

158158
protected Task createBuildPropertiesTask(Project project) {
159-
def buildInfoFile = project.file("${project.buildDir}/grails.build.info")
159+
160+
def resourcesDir = SourceSets.findMainSourceSet(project).output.resourcesDir
161+
def buildInfoFile = new File(resourcesDir, "META-INF/grails.build.info")
162+
160163

161164
def buildPropertiesTask = project.tasks.create("buildProperties")
162165
def buildPropertiesContents = ['grails.env': Environment.isSystemSet() ? Environment.current.name : Environment.PRODUCTION.name,
@@ -168,6 +171,7 @@ class GrailsGradlePlugin extends GroovyPlugin {
168171
buildPropertiesTask.outputs.file(buildInfoFile)
169172
buildPropertiesTask << {
170173
project.buildDir.mkdirs()
174+
ant.mkdir(dir:buildInfoFile.parentFile)
171175
ant.propertyfile(file: buildInfoFile) {
172176
for(me in buildPropertiesTask.inputs.properties) {
173177
entry key: me.key, value: me.value
@@ -176,12 +180,8 @@ class GrailsGradlePlugin extends GroovyPlugin {
176180
}
177181

178182
project.afterEvaluate {
179-
project.tasks.withType(Jar) { Jar jar ->
180-
jar.dependsOn(buildPropertiesTask)
181-
jar.metaInf {
182-
from(buildInfoFile)
183-
}
184-
}
183+
TaskContainer tasks = project.tasks
184+
tasks.findByName("processResources")?.dependsOn(buildPropertiesTask)
185185
}
186186
}
187187

0 commit comments

Comments
 (0)