deleting plugins views (gsp) when building the war

本小妞迷上赌 提交于 2019-12-01 12:57:18

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']
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!