Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Auto Closed
-
2.3
-
None
-
None
Description
In PDE mode the Eclipse plugin creates <linkedResources> in the .project
file. At this point it uses the absolute path of the jar file for the
<location> element. The same happens with the sourcepath attribute in .classpath.
Here's an example of what happens:
.project: <location>/home/max/.m2/repository/ognl/ognl/2.6.9/ognl-2.6.9.jar</location>
.classpath: <classpathentry kind="lib" path="ognl-2.6.9.jar" sourcepath="/home/max/.m2/repository/ognl/ognl/2.6.9/ognl-2.6.9-sources.jar"/>
According to the Eclipse documentation the <location> in .project can be "Either an absolute path, or a relative path whose first segment is the name of a workspace path variable."
So the problem could be solved by defining a "workspace path variable" in Eclipse (not to be confused with the "classpath variable" M2_REPO). This can be done under "Preferences/General/Workspace/Linked Resources" or by adding an entry to ~/workspace/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.core.resources.prefs.
So a possible solution would be:
.project: <location>M2/ognl/ognl/2.6.9/ognl-2.6.9.jar</location>, <location>M2/ognl/ognl/2.6.9/ognl-2.6.9-sources.jar</location>
.classpath: <classpathentry kind="lib" path="ognl-2.6.9.jar" sourcepath="ognl-2.6.9-sources.jar"/>
... where M2 would be the afore mentioned "workspace path variable" which could be created by "mvn eclipse:add-maven-repo".