- Andrew Kos
- Bill Burlein
- Bryan Williams
- Christian Vozar
- Jeff Brown
- John Kraus
- Joseph Mak
- Josh Durbin
- Mark Daugherty
- Matt Van Bergen
- Melissa Geoffrion
- Michael Kang
- Michael Chan
- Michael Hodgdon
- Mike Motherway
- Molly McDaniel
- Nadia Maciulis
- Pat McLoughlin
- Paul Michelotti
- Puru Hemnani
- Rohit Srinath
- Ryan Lunka
- Tom Kelly
All Blogs
CITYTECH Blogroll:
How to Exclude Jars from a Grails 1.2.x WAR
Saturday, February 27, 2010
I have a Grails application that we’re developing and we’re targeting JBoss 5.1 as the production server. Our CI tool (Atalassian Bamboo) produced a production WAR for me which I tried to deploy. Of course I got numerous exceptions and stack traces because I had a copy of servlet-api.jar and xercesImpl.jar already packaged inside my WAR which conflicted with JBoss’ server libs classpath. If you need to remove any artifacts from the Grails build (i.e. grails war), you can write a closure in the bottom of the conf/BuildConfig.groovy such as
//bottom of conf/BuildConfig.groovy
grails.war.resources = { stagingDir ->
File libDir = new File(stagingDir, 'WEB-INF/lib')
def deleteJars = { jarNameStart ->
libDir.eachFile { file ->
if (file.name.startsWith(jarNameStart)) {
file.delete()
println "deleted jar $file"
}
}
}
deleteJars 'servlet-api' // conflicts with jboss 5.1
deleteJars 'xercesImpl' // conflicts with jboss 5.1
}
You will now have a WAR without servlet-api.jar and xercesImpl.jar packaged in the WEB-INF/lib
Feel free to modify to fit your circumstance and environment.
Bill Gloff
Recent Posts
- Descriptive JMX Beans in AEM/CQ
- Invisible requirements within Business requirements
- Building a better Options Predicate
- Javascript, This, and You.
- Extensionless URLs with Adobe Experience Manager
- The Life of a Tester in Adobe CQ World!
- Limitations of the CQ Parsys Model and the Implementation of a Nested Paragraph System
- Google Analytics and AEM: No JavaScript? No Problem.
- Using Apache FOP to generate a PDF document based on a form submission data
- Configuring SAML in AEM 5.6