0

I'm running application on a grails 2.0.3 with resource plugin 1.1.6.

I have missing resources when running 2 instances of the application

Running the first instance with:

grails clean; grails compile; grails -Ddisable.auto.recompile=true -Dserver.port=8081 run-app

The application is running well without any missing resource.

Compiling the second instance:

grails clean; grails compile

After this command I'm refreshing the first instance and I see that the resources(images, messages) are missing. Note that I'm running the applications with the same application name. I checked the .grails/2.0.3/project/ and it seems that the resources are being deleted when I run grails clean for the second instance.

How can I separate those 2 instances to not interfere?

My configuration Config.groovy for resources is:

grails.resources.adhoc.patterns = ['/images/*', '/css/*', '/js/*', '/plugins/*']

grails.resources.modules = {
'core' {
    defaultBundle 'core-ui'

    resource url: '/css/all.css', attrs: [ media: 'screen' ]
    resource url: '/css/lt7.css', attrs: [ media: 'screen' ],
             wrapper: { s -> "<!--[if lt IE 8]>$s<![endif]-->" }
}

'ui' {
    defaultBundle 'core-ui'

    resource url: '/js/main.js', disposition: 'head'
    resource url: '/js/datatable.js', disposition: 'head'
    resource url: '/js/slideBlock.js', disposition: 'head'
}

'input' {
    defaultBundle "input"

    resource url: '/js/form.js', disposition: 'head'
    resource url: '/js/checkbox.js', disposition: 'head'
    resource url: '/js/clearinput.js', disposition: 'head'
}

'panels' {
    defaultBundle 'panels'

    resource url: '/js/panels.js', disposition: 'head'
}

'jquery-validate' {
    defaultBundle "jquery-validate"

    resource url: '/js/jquery-validate/jquery.validate.min.js', disposition: 'head'
    resource url: '/js/jquery-validate/jquery.metadata.js', disposition: 'head'
    resource url: '/js/jquery-validate/additional-methods.min.js', disposition: 'head'
}

overrides {
    'jquery-theme' {
        resource id:'theme', url:'/jquery-ui/themes/app/jquery-ui-1.8.7.custom.css'
    }
}

}

Anyone experienced the same problem? I appreciate if someone can help me. Thanks

2 Answers2

0

Try specifying a new working directory for each instance. The default is something like

<home>/.grails/

Try this ...

grails -Dgrails.work.dir=/home/instance2 -Dserver.port=8081 run-app
Tri
  • 528
  • 2
  • 6
  • I'm running the application in different directories but both end up in .grails/projects/{application_name} when I compile them and since they have the same name the second instance will override the first instance's resources. – user1501362 Jul 16 '12 at 15:08
  • I updated my solution to try specifying the grails.work.dir. Hopefully with that you could use the same app name but with different port. – Tri Jul 17 '12 at 18:55
  • Thanks a lot. This worked and solved the problem. It seems this is just grails 2.0 problem. – user1501362 Jul 17 '12 at 19:45
0

Apparently this has nothing to do with using resources plugin. You probably need different app names, to run them on the same machine. As already pointed out, you need separate folders as well as separate app names for these two or more applications on the same machines to have separate folders.

openSource
  • 191
  • 2
  • 6