Maven copy src/main/resources/services folder to /META-INF

maven-2

EDIT

Ok I can be now more specific:

I have in my scr/main/resources a folder META-INF who contains services/javax.annotation.processing.Processor

My pom is still the same (with commented).
If I do "mvn clean install", the output jar will contains only the META-INF folder.

But if I rename the folder services, the output jar contains my classes and the META-INF folder with the new renamed folder and his content.


I have – I suppose – a easy question for regular maven2 users.
I have this simple pom for a simple subproject

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>aida</groupId>
  <version>0.0.1-SNAPSHOT</version>
  <artifactId>aida-annotationProcessors</artifactId>
  <packaging>jar</packaging>
  <name>AIDA Annotation Processors</name>


  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>    
            </plugin>
        </plugins>
<!--        <resources> -->
<!--            <resource> -->
<!--                <directory>src/main/resources/services</directory> -->
<!--                <targetPath>META-INF/services</targetPath> -->
<!--            </resource> -->
<!--        </resources> -->
    </build>

    <dependencies>
    </dependencies>

</project>

My goal is simple:
I just want to copy my src/main/resources/services/javax.annotation.processing.Processor file in the {root}/META-INF/services folder of my generated jar.

But if I uncomment the resource part, my jar will contains only a META-INF folder without class!

Could you help me?

Best Answer

This is a bug/feature in the maven compiler plugin..

http://jira.codehaus.org/browse/MCOMPILER-97

A workaround is to disable annotation processing for the project containing the processor, -proc:none.