Details

    • Type: Sub-task Sub-task
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.0-RC4
    • Fix Version/s: 1.3-RC1
    • Component/s: None
    • Labels:
      None

      Description

      It should be possible to override services/controllers/etc; summary of problem:

      I've written a plugin, called MyPlugin.

      I've written an app, called MyApp; which is designed to use MyPlugin for
      base/default functionality.

      MyPlugin provides a service, called ThisService.

      MyApp needs to override or replace the ThisService service.

      However when I try to run MyApp, or install MyPlugin into MyApp, when MyApp
      has its own ThisService - I get a: "Invalid duplicate class definition of
      class ThisService" exception.

      This is a major hassle - to get around it I need to temporarily remove
      MyApp's ThisService, then install (or) re-install MyPlugin, then remove
      MyPlugin's ThisService; then finally put MyApp's ThisService back into
      place so that I'm able to continue development/testing with MyApp.

      More info:

      http://www.nabble.com/how-to-override-a-service-provided-by-a-plugin--to15035806.html

        Activity

        Hide
        Donal added a comment -

        Hi,

        I'd like to override the doWithSpring(), doWithDynamicMethods() etc. methods of a plugin. Judging by the discussion above it seems that I could achieve this by defining a class with the same name as the plugin descriptor and placing it in the conf directory, is that right?

        However, it seems like I'll need to wait until version 1.2-M2 before this will work, correct?

        Thanks,
        Don

        Show
        Donal added a comment - Hi, I'd like to override the doWithSpring(), doWithDynamicMethods() etc. methods of a plugin. Judging by the discussion above it seems that I could achieve this by defining a class with the same name as the plugin descriptor and placing it in the conf directory, is that right? However, it seems like I'll need to wait until version 1.2-M2 before this will work, correct? Thanks, Don
        Hide
        Daniel Guryca added a comment -

        I would appreciate this feature too. Hope it's going to be made into 1.2.
        Thanks

        Show
        Daniel Guryca added a comment - I would appreciate this feature too. Hope it's going to be made into 1.2. Thanks
        Hide
        Graeme Rocher added a comment -

        There is no scope / time to resolve these remaining lower priority issues for 1.2 so moving to 1.3

        for 1.2 final only issues considered blocking will now be fixed

        Show
        Graeme Rocher added a comment - There is no scope / time to resolve these remaining lower priority issues for 1.2 so moving to 1.3 for 1.2 final only issues considered blocking will now be fixed
        Hide
        Graeme Rocher added a comment -

        Fixed: http://github.com/grails/grails-core/commit/595d80abe7efede56e22de64d30a5c1fc9110638

        I used a classloading solution for development instead of relying on copying. Also formalized the separation of a plugin classes directory from the main classes directory.

        Show
        Graeme Rocher added a comment - Fixed: http://github.com/grails/grails-core/commit/595d80abe7efede56e22de64d30a5c1fc9110638 I used a classloading solution for development instead of relying on copying. Also formalized the separation of a plugin classes directory from the main classes directory.
        Hide
        Kenny Cheang added a comment -

        I am running 1.3.1. I tried to override a plugin class located in the 'src/groovy' directory but it didn't work. The original plugin class still got loaded. My question is: can we overwrite the classes in the src folder?

        Show
        Kenny Cheang added a comment - I am running 1.3.1. I tried to override a plugin class located in the 'src/groovy' directory but it didn't work. The original plugin class still got loaded. My question is: can we overwrite the classes in the src folder?

          People

          • Assignee:
            Graeme Rocher
            Reporter:
            Corey
          • Votes:
            8 Vote for this issue
            Watchers:
            9 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development