Maven-Eclipse-Plugin: Problem with Project Dependencies

Problem

When creating eclipse meta-data with the maven-eclipse-plugin for plug-in projects, other related projects, which are part of the same eclipse workspace are not added to the project‘s classpath.

Therewith, the project, although it compiles without problems in maven, shows syntax errors such as „[class] cannot be resolved“ and „No available bundle exports […]“.

Solution

One way is to manually disable the feature of the plugin, which tries to configure the project references. You can create the projects using the following command:

mvn eclipse:clean clean package eclipse:eclipse -Declipse.pde -Declipse.useProjectReferences=false install

Another way is to change the way you name your projects. Apparently, the plugin expects the project names to be equal to the Maven artifactIds.

You can also provide your own template for project names using -DprojectNameTemplate=[groupId]-[artifactId].

Resources

Project dependency issue with maven-eclipse-plugin 2.6 (Func Community)
JIRA bug on autodiscovery of project dependencies with the plugin
maven-eclipse-plugin 2.6 project references (Mail)

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