How to run a local plugin in Grails 2.0?

后端 未结 5 1079
时光说笑
时光说笑 2020-12-03 07:40

In Grails, there is a variant how to include local plugin from sources. According to docs, one may type in BuildConfig.groovy:

// Useful to test         


        
相关标签:
5条回答
  • 2020-12-03 08:06

    You can add the .zip file for the plugin in your /lib and it will be installed.

    Example:

    compile ":myPlugin:1.0"
    

    File:

    /lib/myPlugin-1.0.zip
    

    Note: You have to zip the content of the plugin folder.

    Source: http://grails.1312388.n4.nabble.com/Insert-own-local-plugin-into-build-config-td4646704.html

    0 讨论(0)
  • 2020-12-03 08:13

    This works for me

    grails.plugin.location.shiro = "/home/dilbert/dev/plugins/grails-shiro"
    

    Where shiro is the name of the plugin (not the name of the directory it's in). Make sure the path to the plugin is either an absolute path or the relative path to the plugin from the application.

    I've found that this sometimes doesn't work if the plugin is listed in application.properties or BuildConfig.groovy, so if it is, remove it, then execute grails clean and restart the app.

    0 讨论(0)
  • 2020-12-03 08:23

    You can also install the plugin into your local maven cache.

    The documentation speaks about this:

    3.7.10 Deploying to a Maven Repository

    maven-install
    

    The maven-install command will install the Grails project or plugin artifact into your local Maven cache:

    grails maven-install

    This has the advantage of allowing you to include the plugin in your parent application using the more common ":plugin-name:version" syntax

    Which allows your application to determine the best place to retrieve the plugin when in production. From an internal maven-repo or equivalent.

    0 讨论(0)
  • 2020-12-03 08:26

    With Grails 3.x there is another way to do this. Suppose you've a grails app and plugin (source code) inside the same project directory:

    /my-project
    ---/my-app
    ---/grails-shiro
    

    To run your local plugin, you must create a settings.gradle file in the my-projectdirectory specifying the location of your application and plugin:

     include 'my-app', 'grails-shiro'
    

    Then add the dependency in your application's build.gradle:

     compile project(':grails-shiro')
    

    You've done.

    Look at the plugins documentation for more information.

    0 讨论(0)
  • 2020-12-03 08:32

    Surround the plugin name with quotes in case it contains dashes:

    grails.plugin.location.'plugin-name-with-dashes' = "<path>"
    
    0 讨论(0)
提交回复
热议问题