Details
-
Type:
Improvement
-
Status:
Closed
-
Priority:
Trivial
-
Resolution: Duplicate
-
Affects Version/s: 1.0.2
-
Fix Version/s: 1.0.3
-
Component/s: Project infrastructure
-
Labels:None
Description
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
Issue Links
| This issue relates to: | ||||
| GRAILS-2771 | Run more than one version of a Grails app in the same container |
|
|
|
| This issue is related to: | ||||
| GRAILS-2665 | Tomcat deployment error with 2 versions of a Grails app: "Choose unique values for the 'webAppRootKey' " |
|
|
|
Activity
- All
- Comments
- Work Log
- History
- Activity
- Git Commits