Grails

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

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.0.1
  • Fix Version/s: 1.0.2
  • Component/s: ContinuousBuild
  • Labels:
    None
  • Environment:
    Grails 1.0.1 on windows

Description

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.

Activity

Hide
InterZ added a comment -

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

Show
InterZ added a comment - 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
Hide
InterZ added a comment -

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

Show
InterZ added a comment - 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
Hide
Graeme Rocher added a comment -

Bulk closing bunch of resolved issues

Show
Graeme Rocher added a comment - Bulk closing bunch of resolved issues

People

Vote (2)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: