deleting plugins views (gsp) when building the war

后端 未结 1 1356
予麋鹿
予麋鹿 2021-01-16 01:09

We are using various plugins in our grails application (like logging, spring security core, ui, acl and many others). Now these plugins come with default gsps (in the views

相关标签:
1条回答
  • 2021-01-16 01:55

    I answered this question on the Grails mailing list. http://grails.1312388.n4.nabble.com/deleting-plugins-views-gsp-when-building-the-war-td4560517.html (The answer hasn't yet shown up in nabble)

    You can remove/add files from/to a war file in the eventCreateWarStart event specified in scripts/_Events.groovy file.

    This might work:

    filename: scripts/_Events.groovy

    eventCreateWarStart = { warName, stagingDir ->
       Ant.delete(dir: "${stagingDir}/WEB-INF/plugins/logging-0.1/grails-app/views")
       Ant.delete(dir: "${stagingDir}/WEB-INF/classes", includes:"gsp_logging*.*")
       Ant.delete(dir: "${stagingDir}/WEB-INF/plugins/spring-security-ui-0.1.2/grails-app/views")
       Ant.delete(dir: "${stagingDir}/WEB-INF/classes", includes:"gsp_springSecurityUi*.*")
    }
    

    I'm not sure if you could also remove plugin Controller classes without problems. We've used Filter classes to "disable" controllers provided by plugins.

    As a side-note you can disable "development-only" plugins in the production environment by using the yet undocumented "grails.plugins.excludes" feature:

    Example: in Config.groovy:

    import grails.util.Environment
    
    if(Environment.current == Environment.PRODUCTION) {
        grails.plugin.excludes = ['somePluginName']
    }
    
    0 讨论(0)
提交回复
热议问题