build-helper-maven-plugin add-source does not working when trying to add linked resources

Posted by Julian on Stack Overflow See other posts from Stack Overflow or by Julian
Published on 2012-08-08T06:13:14Z Indexed on 2012/11/27 11:04 UTC
Read the original article Hit count: 150

Filed under:
|

I am new to maven and hit a problem that looks easy in the first place but I already kept me busy for a whole day about and no way to get it working.

First as part of running eclipse:eclipse plugin I create a linked folder like below:

<linkedResources>
<linkedResource>
    <name>properties</name>
    <type>2</type>
    <location>${PARENT-2-PROJECT_LOC}/some_other_project/properties</location>
</linkedResource>
<linkedResource>
    <name>properties/messages.properties</name>
    <type>1</type>
    <location>${PARENT-2-PROJECT_LOC}/some_other_project/properties/messages.properties</location>
</linkedResource>

And then I am adding that folder as a source folder like below:

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.7</version>
<executions>
  <execution>
    <id>add-source</id>
    <phase>generate-sources</phase>
    <goals>
      <goal>add-source</goal>
    </goals>
    <configuration>
      <sources>
        <source>properties</source>
        <source>some_real_folder</source>
      </sources>
    </configuration>
  </execution>
</executions>
</plugin>

However when I am looking at the generated .classpath in eclipse the “some_real_folder” is there but the “properties” is not. It looks like by default the build-helper-maven-plugin will check if the folder is there and if it is not it won’t add it.

I am using maven 3.0.4 outside eclipse to run the build and I can see in the maven logs something like this:

[INFO] Source directory: <some path>\properties added.

This is my project structure:

project1 
  \-- properties (this is the real folder) 

project2
   \-- some_real_folder
   \-- properties (this is the link resource pointing to the project1/properties folder)

All I need is to have both "some_real_folder" and the linked resource "properties" added to the .classpath of the project2

© Stack Overflow or respective owner

Related posts about maven

Related posts about maven-eclipse-plugin