7

We are using maven to manage our idea projects but I'm having a problem excluding a directory from the idea project.

Using idea, I would just go to Project Settings | Modules | Sources and select the folder I wanted to exclude and click on the "Excluded" button. When loading the project from the pom, target is excluded automatically. I want to exclude a logs folder as well.

In maven I'm using an idea maven plugin and it says I can exclude folders. I'm using this code but it doesn't seem to work:

<plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-idea-plugin</artifactId>
            <version>2.3-atlassian-1</version>
            <configuration>
                <downloadSources>true</downloadSources>
                <downloadJavadocs>true</downloadJavadocs>
                <exclude>
                    ${project.basedir}/logs
                </exclude>
            </configuration>
        </plugin>

I've tried different formats as well as putting in the fully qualified path (as a test) but nothing seems to exclude the logs directory from my idea project.

Anyone any ideas on how to get this working?

Thanks, Nick.

Boomah
  • 1,172
  • 13
  • 24

1 Answers1

6

I just did a small test and, with the following snippet:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-idea-plugin</artifactId>
  <configuration>
    <exclude>test-output,.clover,logs</exclude>
  </configuration>
</plugin>

The generated .iml file contains the following entries:

  <excludeFolder url="file://$MODULE_DIR$/.clover"/>
  <excludeFolder url="file://$MODULE_DIR$/logs"/>
  <excludeFolder url="file://$MODULE_DIR$/target"/>
  <excludeFolder url="file://$MODULE_DIR$/test-output"/>

Which is to my knowledge the expected result.

Do you get something different? Are you expecting somehting else?

Pascal Thivent
  • 562,542
  • 136
  • 1,062
  • 1,124
  • 1
    Hi. That is the expected result but I'm not getting it. We've been seeing funny things happening with maven and think it might be something to do with the scala plugin we're using. Maybe this is causing the idea plugin not to work properly as well. Which version are you using as in the example I guess it is just using the latest? – Boomah Feb 01 '10 at 11:51
  • 1
    This was with the version 2.2 of the plugin. Maybe the scala plugin is causing some confusion indeed, didn't test that. – Pascal Thivent Feb 01 '10 at 12:09
  • 4
    Recent versions of IntelliJ is able to open maven projects directly which we use. Is there an approach which works with that? – Thorbjørn Ravn Andersen Jan 04 '17 at 14:12
  • 10
    Note this answer is outdated, hopes for a better solution. – aristotll Dec 01 '17 at 11:19