Intellij Maven build Glassfish exploded ear deployment and war/ejb folder naming
Hello,
I am having an annoying issue with the deployment of my ear web application into glassfish with IDEA. I have a Maven project that builds a ear out of a war and ejb. Things are working very well and I am happy with the setup except for one issue. When I refresh/reimport the maven project it names the exploded version of the ear as follows:
ear/
blah.war/ <-- folder
blah.jar/ <--- folder
The exploded directories are named with the .war and .jar extensions of the compressed counterparts. This throws a wrench at Glassfish, which in turn gives me the following exception during startup:
java.io.FileNotFoundException: <omitted>\ear\target\ear\blah.jar (Access is denied)
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:114)
at java.util.jar.JarFile.<init>(JarFile.java:133)
at java.util.jar.JarFile.<init>(JarFile.java:97)
at org.apache.catalina.startup.TldConfig.tldScanJar(TldConfig.java:604)
at org.apache.catalina.startup.TldConfig.execute(TldConfig.java:464)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:5247)
at com.sun.enterprise.web.WebModule.start(WebModule.java:353)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:989)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:973)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:704)
at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1627)
at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1232)
So, it looks like Glassfish thinks the exploded blah.jar directories is a compressed .jar files. I can then rename the exploded directories to 'blahWar' and 'blahEjb' and redeploy (without refreshing Maven inbetween) in the artifacts settings under project structure, fix the ear's application.xml and Glassfish starts up my application properly.
Is there a way to set the war/jar explosion to not use the original compressed artifact's full name? Maybe replacing the '.war' with an '_war' . Is this a bug that can or is being resolved with Intellij IDEA?
Thanks for your response.
Please sign in to leave a comment.
Hi John,
if MAVEN do the build, use the <unpackTypes> tag of the Maven EAR plugin in the POM.