History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: GRAILS-2724
Type: Improvement Improvement
Status: Closed Closed
Resolution: Duplicate
Priority: Trivial Trivial
Assignee: Graeme Rocher
Reporter: Felipe Nascimento
Votes: 0
Watchers: 0
Operations

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

Add a way to ease deployment of different instances of the same application in the same tomcat

Created: 25/Mar/08 02:05 PM   Updated: 12/May/08 08:53 PM
Component/s: Project infrastructure
Affects Version/s: 1.0.2
Fix Version/s: 1.0.3

Time Tracking:
Not Specified

Issue Links:
Related


 Description  « Hide
I want to deploy the same application many times, in the same tomcat.
But I need to always edit application.properties to change application name so that the grails.project.key is changed in web.xml.
I have done this with little changes to Package.groovy, so I could something like:
grails -Dgrails.env=malabaris -Dapp.name=malabaris -Dproject.key=malabaris my-war

MyWar is the following script:
----------------------------------------------------------------------------------------------------
import org.codehaus.groovy.grails.commons.GrailsClassUtils as GCU

grailsHome = Ant.project.properties."environment.GRAILS_HOME"

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

target('default': "The description of the script goes here!") {
if(System.getProperty("app.name")) grailsAppName = System.getProperty("app.name")
def tmpWebXml = "${userHome}/.grails/${grailsVersion}/projects/${baseName}/web.xml.tmp"
Ant.delete(file:tmpWebXml, failonerror:false)
war()
}

----------------------------------------------------------------------------------------------------

The thig here is that tmpWebXml must be deleted so it is generated again and grails.project.key is replaced with the correct value.

Changes to Package.groovy were in generateWebXml target:
----------------------------------------------------------------------------------------------------
def grailsProjKey = Ant.antProject.properties.'grails.project.key'
if(System.getProperty("project.key")){ grailsProjKey = System.getProperty("project.key") }
Ant.replace(file:tmpWebXml, token:"@grails.project.key@", value:"${grailsProjKey}")
----------------------------------------------------------------------------------------------------

With these minor enhancements, I dont need anymore to edit application.properties, and I could create a bat file to each instance of the application.

Felipe



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
There are no comments yet on this issue.