Reputation: 1179
In my Eclipse RCP project, I am using a self-created library (Library A) that is also used in other Java projects, which are not Eclipse RCP projects.
I can add this library to the Target Platform as a Maven dependency, and Tycho successfully picks it up to build the project. So far, this works as expected.
Library A is added with the following lines to the target platform definition:
<location includeDependencyDepth="direct" includeDependencyScopes="compile" includeSource="true" missingManifest="generate" type="Maven" label="libA">
<dependencies>
<dependency>
<groupId>com.foo</groupId>
<artifactId>A</artifactId>
<version>5.1.0-SNAPSHOT</version>
</dependency>
</location>
The Problem: When I open the library in Eclipse (IDE), Eclipse treats the library (Library A) used in the RCP plugins as different from the version opened in my workspace. For example, if I jump from a class in an RCP plugin to a class from Library A (via CTRL + Click), Eclipse opens the .class file instead of the .java file from the workspace.
Additionally, searching for occurrences of a class from Library A in the RCP plugins does not either.
Question: How can I configure my Eclipse RCP project so that Eclipse recognizes that the library used in the RCP plugins is the same as the one in my workspace, and allows proper navigation and searching between them?
Upvotes: -1
Views: 63
Reputation: 1179
Since library A was built as a normal JAR, I suspected that the artificially created wrapper plugin was the issue.
I therefore converted library A to an OSGi bundle by modifying its pom.xml
. I added:
<packaging>bundle</packaging>
and
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>5.1.9</version>
<extensions>true</extensions>
<configuration>
<excludeDependencies>*</excludeDependencies>
<instructions>
<Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
<BundleVersion>${project.version}</BundleVersion>
<Export-Package>*</Export-Package>
</instructions>
</configuration>
</plugin>
In the target platform definition file I changed the entry for library A.
I changed missingManifest
to error
and type
to bundle
.
<location includeDependencyDepth="direct" includeDependencyScopes="compile" includeSource="true" missingManifest="error" type="Maven" label="libA">
<dependencies>
<dependency>
<groupId>com.foo</groupId>
<artifactId>A</artifactId>
<version>5.1.0-SNAPSHOT</version>
<type>bundle</type>
</dependency>
</location>
At first Eclipse did not pick up the changes, because I still had an older A-Snapshot in my local and remote Maven-repository and apparently also in some Eclipse cache. (Incrementing the version number might help, to resolve these kind of conflicts.) The Eclipse view Target Platform State was very helpful in determining wheter Eclipse was using library A from the workspace or from the local Maven-repository.
In conclusion, converting the self-created library into an OSGi bundle solved the issue.
Upvotes: 0