I am using the maven-eclipse-plugin (not M2E!) to generate my project. I have checked out the project under a source directory: C:\source, and this source is not organized in the Maven convention. My eclipse work space is under C:\eclipse\workspace, where I have the POM files.
In the POM, I have specified to create linked / virtual folders to organize the source in the Maven format (src/main/java, etc):
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.9</version>
<configuration>
<linkedResources combine.children="append">
<linkedResource>
<name>src</name>
<type>2</type>
<locationURI>virtual:/virtual</locationURI>
</linkedResource>
<linkedResource>
<name>src/main</name>
<type>2</type>
<locationURI>virtual:/virtual</locationURI>
</linkedResource>
<linkedResource>
<name>src/main/java</name>
<type>2</type>
<locationURI>WORKSPACE_LOC/source/mymodule</locationURI>
</linkedResource>
</linkedResources>
...
</plugin>
When I create a project for eclipse by running mvn eclipse:clean eclipse:eclipse
, the .project
file hence generated has linked folders (or virtual folders):
<linkedResources>
<link>
<name>src</name>
<type>2</type>
<locationURI>virtual:/virtual</locationURI>
</link>
<link>
<name>src/main</name>
<type>2</type>
<locationURI>virtual:/virtual</locationURI>
</link>
<link>
<name>src/main/java</name>
<type>2</type>
<locationURI>WORKSPACE_LOC/source/mymodule</locationURI>
</link>
</linkedResources>
but the .classpath
file generated does not add those folders to the classpath as source folders for my project, i.e., an entry like the following is missing:
<classpathentry including="**/*.java" kind="src" path="src/main/java"/>
If I were to create a project using eclipse (and not using the maven-eclipse-plugin), I could create virtual / linked folders as necessary and add them as source folders to the project.
Using the plugin, I am forced to point to the absolute path to the source folder as sourceDirectory. The plugin does not seem to recognize linked / virtual folders and hence does not add them as a source folder to my project. Is there a solution for this where I can add a linked folder as a source folder to my eclipse project generated using the Maven eclipse plugin?
Thanks in advance.