开发者

Grails Events: Copying directories around at Build time to get a clean 'multi-tenant' deployment effect

开发者 https://www.devze.com 2023-03-24 02:29 出处:网络
I\'m working on a sort of \'multi-tenant\' grails app that will开发者_运维百科 be used as a \'platform\' upon which quick sites will be developed.

I'm working on a sort of 'multi-tenant' grails app that will开发者_运维百科 be used as a 'platform' upon which quick sites will be developed.

A 'site' will include a layout, images, and page gsps.

Right now, these are spread across the project in their normal locations, eg:

/grails-app/views/layout
/grails-app/views/<site>
/web-app/images/

Ideally, they'd all be in one place, centralized by site, like

/sites/<site>/layout
/sites/<site>/pages/
/sites/<site>/imagtes

My current thinking is this could be accomplished with a Build.groovy script and doing some ant trickery at build time. But I'm not sure if it's possible to do this copying-by-convention - ie I don't know the directories that are present until it runs. (I'm also no ant guru)

Any ideas/suggestions? Thanks!


I have used the following script, named _Events.groovy and located in a scripts folder under your grails application, to copy files before my build:

includeTargets << grailsScript("_GrailsEvents")

 eventSetClasspath  = { msg ->
    println "Custom Configuration"
    ant.copy(todir:classesDirPath) {
        fileset(dir:"${basedir}/config")
    }
 }

And I suppose you could use something very similar.

Relevant grails documentation is here

0

精彩评论

暂无评论...
验证码 换一张
取 消