Issue Details (XML | Word | Printable)

Key: GRAILS-2657
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Graeme Rocher
Reporter: InterZ
Votes: 2
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Grails

Invoking war() target from within another script, fails to properly replace log4j dev configuration in web.xml

Created: 18/Mar/08 12:29 PM   Updated: 19/Mar/08 10:35 AM   Resolved: 19/Mar/08 10:35 AM
Component/s: ContinuousBuild
Affects Version/s: 1.0.1
Fix Version/s: 1.0.2

Time Tracking:
Not Specified

Environment: Grails 1.0.1 on windows


 Description  « Hide

Hi,
I have a custom script created via grails create-script

At the top of my file I include the following:

includeTargets << new File ( "${grailsHome}/scripts/Init.groovy" )
includeTargets << new File ( "${grailsHome}/scripts/War.groovy" )

Within my script I call war(). The war file that is generated still contains the development path to the log4jproperties in the web.xml which dies when the app is deployed to a container. If I do a "grails war" everything works fine.

I believe this is related to the file below which checks for "war" or "run-war" as the script name in order to alter the log4j param. When I run "my-script" since it does not contain "war" or "run-war" but merely calls the "war()" target, this code does not execute.

http://svn.grails.codehaus.org/browse/grails/trunk/grails/src/groovy/org/codehaus/groovy/grails/plugins/LoggingGrailsPlugin.groovy?r1=6628&r2=6664

The temporary fix hack is to rename my script to contain the word "war" in it.



InterZ added a comment - 18/Mar/08 12:47 PM

Follow up, I mis-read the code. Renaming the calling custom script to simply include the word "war" does not fix this. The code that controls the replacement looks explicitly for "war" or "run-war".

The hack fix is to set System.setProperty('current.gant.script',"war") at the top of my custom script


InterZ added a comment - 18/Mar/08 12:49 PM

Actually this is the temporary fix you have to put at the top of your custom script that calls the war() target

System.setProperty('current.gant.script',"war") // TMP HACK for http://jira.codehaus.org/browse/GRAILS-2657