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
It is a bad practice to include stuff from outside a artefact directly into a artefact. You should only include into project2 stuff below folder project2 and something from project2's dependencies. (I'm not sure whether what you are doing is possible at all.)
So, if you want to have project1/properties available in project2, you usually pack project1/properties in project1's artefact and add a dependency on project1 to project2. If this does not work for some reason (for example since you want to move project1's stuff to another location in project2) you can unpack it with maven-dependency-plugin dependency:copy-dependencies into project2's target to some appropriate place.