Support for web-fragment.xml

Hello,

I'm starting developing web modules using the web fragments specified in Java Servlet 3.0 Specification. I already read (http://blogs.jetbrains.com/idea/2009/10/servlet-30-jsr-315-support-in-maia/) but couldn't find a solution for the following problem:

I'm trying to develop a web application (maven-archetype-webapp) together with a couple of web-modules (maven-archetype-quickstart). My modules (module1, module2) are located within the webapp module (webapp) as follows:

webapp

-- module1

-- module2


As I'm using maven my web-fragment.xml files are located in, e.g.:


webapp/module1/src/main/resources/META-INF/web-fragment.xml

In the web fragment configuration of both web modules I specified the correct web-fragment.xml in the 'Deployment Descriptors' group (Project Structure dialog).

Now I was hoping that Intellij IDEA would merge the web-fragment.xml files with the webapp/src/main/webapp/WEB-INF/web.xml located in the webapp module (as I specified Deployment Descriptor version 3.0 in the Deployment Descriptor Location dialog), but somehow only the web.xml file of the webapp module is considered and no merging occurs. Tomcat will only merge web-fragment.xml files located in jar files.

As this usecase, working at a couple of web-modules with web-fragment.xml files without the necessity to deploy them as jars, is quite important for us I wanted to know whether this usecase is or will be supported by IDEA Ultimate 10.5 or later versions?

Thx,
Rudolf
3 comments
Comment actions Permalink

I'm afraid IDEA does not support such a scenario. Feel free to submit a
feature request for this.

0
Comment actions Permalink

I've recently come across this problem while working on a web application which has a dependency on a web module with a web fragment (i.e. resources/META-INF/web-fragment.xml). Even though the web fragment is present in the web module compile output and included in the IntelliJ Artifact classes directory, which is deployed in a runtime configuration, the web app doesn't find it and the application fails.

The best way I've found to get round this problem is to use 'Create Archive' in Project Settings Artifact (exploded war, etc.) lib directory for the webapp and add the web module's META-INF/MANIFEST.MF and META-INF/web-fragment.xml to the created archive (e.g. archive.jar). Use right click -> Add Copy of -> file on the archive to add files and manifest, etc.

0

Please sign in to leave a comment.