Where does the 'overlays' directory come from?

I have a maven 2 project (WAR) that depends on another WAR dependency.  It seems that intellij insists on unpacking this dependency into an 'overlays' directory at the root of my project.  Is there any way to configure where this directory is created?  I'd rather have it unpacked somewhere under the 'target' directory so it's not cluttering up my project.

Thanks!
David

12 comments
Comment actions Permalink

could you post the relevant part of your pom.xml? I have the same requirement but I'm not seeing this behaviour (AFAIR)

0
Comment actions Permalink

It's pretty straighforward:

<groupId>com.mycompany</groupId>
<artifactId>myproject</artifactId>
<version>1.2.3</version>
<packaging>war</packaging>
<dependencies>
    <dependency>
        <groupId>com.mycompany</groupId>
        <artifactId>anotherproject</artifactId>
        <version>2.3</version>
        <type>war</type>
        <scope>runtime</scope>
    </dependency>
    ....
</dependencies>
....

0
Comment actions Permalink

Hm, same here. Do you have maven-war-plugin configured explicitly? What maven version/maven-war-plugin version are you using?

0
Comment actions Permalink

My WAR plugin is configured something like this:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.1-alpha-1</version>
    <configuration>
        <archive>
            <manifestEntries>
                <Implementation-Title>${project.artifactId}</Implementation-Title>
                <Implementation-Version>${project.version}</Implementation-Version>
            </manifestEntries>
        </archive>
        <webResources>
            <resource>
                <directory>${core.unpack.dir}</directory>
                <includes>
                    <include>*-servlet.xml</include>
                    <include>*Context.xml</include>
                    <include>*.properties</include>
                </includes>
                <targetPath>WEB-INF/classes</targetPath>
            </resource>
        </webResources>
    </configuration>
</plugin>


The ${core.unpack.dir} is set to something inside the 'target' directory.

0
Comment actions Permalink

Hm, I don't have any explicit configuration for the war-plugin, that might be the cause. You might want to file a JIRA issue about this behaviour then.

0
Comment actions Permalink

Hi,

The Maven Integration indeed unpacks all overlays under the mentioned folder.
There is not problem to unpack it under the target dir; though, all overlays should be added as web roots to the project and, thus, will prevent the target dir to be excluded.

Let me know if you have any ideas and I'll implement it the best way.

Thanks,
Anton Makeev.

0
Comment actions Permalink

I guess my question is what needs the overlays directory?  In the Web facet for my module, I have the 'Create web facet war file' and 'Create web facet exploded directory' checkboxes under the Java EE Build Settings tab unchecked.  Is the overlays directory created as part of this?  Or does it need the unpacked WAR dependencies for some other purpose?

0
Comment actions Permalink

This folder is created by Maven Integration to mime Maven's war overlays functionality.

0
Comment actions Permalink

To what end?  Is it simply to create the final WAR file during a build in IntelliJ?  Or does IntelliJ need the contents of the unpacked WAR files for some other purpose?  If I've got the options for IntelliJ to create the WAR file turned off, it seems like it shouldn't bother with the 'overlays' directory either.

David

0
Comment actions Permalink

Hi,
The content of the overlay must be available to allow code-insight means such as completion and navigation

Thanks,
Anton Makeev.

0
Comment actions Permalink

Ok...that makes sense.  I would offer the suggestion that a special directory be created in the project directory (.IntelliJIDEA?) where things such as the 'overlays' directory could be placed.  This would make it easier to exclude from subversion since one would only have to add a single entry to the svn:ignore list.

David

0
Comment actions Permalink

Hello,

sorry to bump an old thread, but this is exactly the discussion I was looking for. :)

I currently am using IDEA 15.04 and the behaviour does not seem to have changed.  

I find the content of the "overlays" folder super, because it allows me to see exactly what is being included and excluded from the overlay WAR, but as David mentioned the location top-level "overlays" directory is not very maven-like :).   But putting it under the ${project.build.directory} (/target/overlays) would most likely cause problems with a "mvn clean" wiping the files that the IDE is using.  

It does seem to make more sense to me to keep the "overlays" directory local to the module and not in the top-level Project ".idea" directory.

Currently I just manually add "overlays" as a svn:ignore which works fine.

One other small thing I noticed is when the overlay WAR version changes, the previous directory in the "overlays" directory is not cleaned up (removed).  Maybe this could be optimized.

Cheers, Jeff

0

Please sign in to leave a comment.