We have an Eclipse plugin that we create using Maven and Tycho. At the moment, however, we still provide all the project dependencies through a bunch of manually added JAR files, not Maven. This is due to the following reasons: (1) dependencies are not available through the standard Eclipse update site (at least not in the current version), (2) dependencies are not available as packages.
Most of these dependencies are Selenium libraries (APIs, Remote, browser-specific libraries and their transitive dependencies, such as Guava, etc.)
I spent several hours trying to pull out these dependencies during the build of Maven. Following this SO question, I tried p2-maven-plugin , created an update site with our dependencies, which I added to my target Eclipse platform. However, at runtime, the classes referenced by different JARs cannot be (I suppose from my very limited knowledge of OSGi, because some of the necessary information was missing in the MANIFEST.MF files). Here is an example of a problem when trying to create a RemoteWebDriver that uses DesiredCapabilities (both classes in different packages):
Exception in thread "Thread-8" java.lang.NoClassDefFoundError: org/openqa/selenium/remote/DesiredCapabilities at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:243) at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:126) at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:153) β¦ Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.remote.DesiredCapabilities cannot be found by org.seleniumhq.selenium.remote-driver_2.45.0 at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:439) at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:352) at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:344) at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:160) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 7 more
Is there anything else I need to take care of when using the p2-maven-plugin ? The relevant parts of pom.xml looked like this:
<plugin> <groupId>org.reficio</groupId> <artifactId>p2-maven-plugin</artifactId> <version>1.1.1-SNAPSHOT</version> <executions> <execution> <id>default-cli</id> <configuration> <artifacts> <artifact> <id>org.seleniumhq.selenium:selenium-remote-driver:2.45.0</id> </artifact> </artifacts> </configuration> </execution> </executions> </plugin>
source share