Home > Maven > Maven – folders excluded by default

Maven – folders excluded by default

While working on a Maven plugin that copies resources (similarly to “maven-resources-plugin” but with a few important differences, more on that later) I had to put a list of folders excluded by default.

Finally found it here: org.codehaus.plexus.util.DirectoryScanner.DEFAULTEXCLUDES.
It is part of org.codehaus.plexus:plexus-utils (javadoc) that is brought by org.apache.maven:maven-project (javadoc) which is used by plugin authors for many things (by having MavenProject as Mojo parameter), one of them is accessing Maven properties:

@MojoParameter( expression = "${project}" )
private MavenProject mavenProject;
public  MavenProject getProject ()
{
    return this.mavenProject;
}

…

getProject().getProperties().setProperty( propertyName, value );

So, DirectoryScanner.DEFAULTEXCLUDES:

  • **/*~
  • **/#*#
  • **/.#*
  • **/%*%
  • **/._*
  • **/CVS
  • **/CVS/**
  • **/.cvsignore
  • **/SCCS
  • **/SCCS/**
  • **/vssver.scc
  • **/.svn
  • **/.svn/**
  • **/.arch-ids
  • **/.arch-ids/**
  • **/.bzr
  • **/.bzr/**
  • **/.MySCMServerInfo
  • **/.DS_Store

A bigger list is available through hidden.org.codehaus.plexus.util.AbstractScanner.DEFAULTEXCLUDES inside “apache-maven-2.2.0/lib/maven-2.2.0-uber.jar” but I don’t see how it can be used by Maven plugin (besides copy-pasting the list manually, of course):

  • **/*~
  • **/#*#
  • **/.#*
  • **/%*%
  • **/._*
  • **/CVS
  • **/CVS/**
  • **/.cvsignore
  • **/RCS
  • **/RCS/**
  • **/SCCS
  • **/SCCS/**
  • **/vssver.scc
  • **/.svn
  • **/.svn/**
  • **/.arch-ids
  • **/.arch-ids/**
  • **/.bzr
  • **/.bzr/**
  • **/.MySCMServerInfo
  • **/.DS_Store
  • **/.metadata
  • **/.metadata/**
  • **/.hg
  • **/.hg/**
  • **/.git
  • **/.git/**
  • **/BitKeeper
  • **/BitKeeper/**
  • **/ChangeSet
  • **/ChangeSet/**
  • **/_darcs
  • **/_darcs/**
  • **/.darcsrepo
  • **/.darcsrepo/**
  • **/-darcs-backup*
  • **/.darcs-temp-mail

Enjoy ! 🙂

Update: the situation described above is correct only for org.codehaus.plexus:plexus-utils:1.5.6, in 1.5.15 – DirectoryScanner has a bigger list similar to that in “maven-2.2.0-uber.jar”.

I’m adding explicit plexus-utils version to my plugins POM:

<dependencies>
    <dependency>
        <groupId>org.apache.maven</groupId>
        <artifactId>maven-plugin-api</artifactId>
        <version>2.2.0</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.apache.maven</groupId>
        <artifactId>maven-project</artifactId>
        <version>2.2.0</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.codehaus.plexus</groupId>
        <artifactId>plexus-utils</artifactId>
        <version>1.5.15</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.apache.maven.shared</groupId>
        <artifactId>file-management</artifactId>
        <version>1.2.1</version>
        <scope>compile</scope>
    </dependency>

    <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
    <!-- http://www.jfrog.org/sites/mvn-anno-mojo/latest/ -->
    <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->

    <dependency>
        <groupId>org.jfrog.maven.annomojo</groupId>
        <artifactId>maven-plugin-anno</artifactId>
        <version>1.3.2</version>
    </dependency>
</dependencies>
Advertisements
Categories: Maven Tags:
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: