Maven Overlays

Hello folks

I've got a maven multi-module project with an overlays module also included. The overlays are used through maven overlays <overlays><overlay>...</overlay><overlays> in the maven-war plugin. And this works when I build the artifact through a normal maven package.

However, when working with the IDE, I always have to add the overlays module as a facet to get all my overlays content copied over to the main web-app. And this keeps dissapearing everytime I do a re-import.

I have my deployment through the IDE on a local tomcat instance using the web facet exploded directory option.

Is there anythig I need to do or any known issue around intelliJ honoring the maven's overlays capability?

Cheers
-- Imran

9 comments
Comment actions Permalink

This is expected to work, I've just rechecked.

Please attach a sample project that shows the problem and describe what you think is wrong and what you expect IDEA to do.

Thanks,
Anton Makeev

0
Comment actions Permalink

Thanks Anton for your response.

Here's a quick sample I knocked up just to demonstrate what's happening.

The sample consists two web modules. The common module is meant to be overlayed into greetings as given in the pom.xml for the greetings module. This overlay works as expected when I do a normal mvn clean install. i.e. All jsps under the common module are copied over to the greetings module (just 2 jsps are all I have in the common module). These two modules have a parent pom which drives the multi module build.

I've setup my intelliJ project through the parent pom. I've set a seperate directory to which these gets built on and runs from on a local tomcat container configured through intelliJ. However, when I do a make, my jsps in the common module are not copied over to the greetings web app. If then I go to the project structure of the greetings module, and Add the common module as a facet in the 'Module and Libraries to package' section, and rebuild (or make) the files are copied over as expected. Furthermore, if I do a maven re-import, my facets that I added are wiped out as well. Which forces me to always add the web facet when I do a re-import.

What I'd expect intelliJ to do is, when the pom is imported, identify the overlay feature and add the dependency as a facet which would then operate correctly on the intelliJ build.

Hope this describes my problem better. Is there any thing I'm missing here? Looking forward for your response.

Cheers
-- Imran



Attachment(s):
overlay.zip
0
Comment actions Permalink

Thanks for the sample.

The problem was that IDEA didn't pick up module overlays such those in your project; I've added this functionality.
The fix will be available in the next eap.

Thank for the feedback,
Anton Makeev

0
Comment actions Permalink

Thanks Anton.

So is maven-overlays as configured in the sample I sent not currently meant to be supported? Is there any other way I should configure this otherwise (not sure if this is valid as I'm basically going with the maven overlays guidelines) or is it best waiting for your fix.

Also roughly which version of intelliJ would you plan to release this on. I'm hopeful that it would be in perhaps a 8.1.5 release? And what would be a tentative time line? Looking forward for a favourable answer.

Cheers
-- Imran

0
Comment actions Permalink

Hi,

Yes, it is not suppored at the moment - only non-module overlays are supported (those, that have no modules in the current IDEA project).
I'm not sure if it will be fixed in 8.x since we are targeting on 9.0 now.

Thanks,
Anton Makeev

0
Comment actions Permalink

Thanks for that. Could you let me know when you've released a version of 9 beta with these fixes in. I dont mind giving it a test run when its ready.

Cheers
-- Imran

0
Comment actions Permalink

From what I see this is supposed to work in IntelliJ 9, but it seems that our overlays still aren't recognized correctly.

Our project contains a number of flex modules, some java server modules and a web application module which builds the war file.
The flex modules compile swf's to their target/ directory. (using flexmojos). They have <packaging>swf</packaging> and use the maven assembly plugin to build war files that are then included as overlays in the web app module.

The 'webapp' module uses the maven war plugin to package everything:

         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <configuration>
               <warName>ROOT</warName>
               <overlays>
                  <!-- Flex UI applications -->
                  <overlay>
                     <groupId>com.eclipse.luma</groupId>
                     <artifactId>lw2pcwizardluma</artifactId>
                     <targetPath>Luma</targetPath>
                  </overlay>
                  <overlay>
                     <groupId>com.eclipse.luma</groupId>
                     <artifactId>lw2pcconfig</artifactId>
                     <targetPath>Luma</targetPath>
                  </overlay>
                  <overlay>
                     <groupId>com.eclipse.luma</groupId>
                     <artifactId>lw2pcprod</artifactId>
                     <targetPath>Luma</targetPath>
                  </overlay>
                  ....
                  <overlay>
                     <groupId>com.eclipse.flex.fonts.collections</groupId>
                     <artifactId>Luma</artifactId>
                     <targetPath>Luma</targetPath>
                  </overlay>
                 ......

After importing into IntelliJ9, the webapp artifact only contains the server resources, and the last shown overlay above which is the only one not referring to a module.

I don't know if this gives you enough information. I could attach all pom files if this would help.

0
Comment actions Permalink

Yes, please either attach your pom files here or send them to me at Anton<dot>Makeev<at>jetbrains<dot>com.
Please preserve the directory structure.

Thanks,
Anton Makeev

0
Comment actions Permalink

I realize that it's bean a while, but as more teams are starting to use IJ I'm just now looking into this again.
I will send you our pom structure by mail so that you can have a look.

Christian

0

Please sign in to leave a comment.