Excude all the unnecessary jar from war file

2019-07-16 03:49发布

问题:

I am a grails programmer and I want to remove the unnecessary jar files that are included in the war file. There are so many unnecessary jar files included in the war file. Is there any quick solution to do so? Also can you mention the jar files which are necessary to make and run the simple grails war.

回答1:

You can exclude unnecessary jar from war by adding following lines in BuildConfig.groovy.

grails.war.resources = { stagingDir ->
  delete(file:"${stagingDir}/WEB-INF/lib/jarFileName.jar")
}

Example : Removing hibernate core

grails.war.resources = { stagingDir ->
  delete(file:"${stagingDir}/WEB-INF/lib/hibernate-core-3.3.1.GA.jar")
}