| Summary: | Find a way to import org.hamcrest as package dependency | ||
|---|---|---|---|
| Product: | [Technology] EGit | Reporter: | Matthias Sohn <matthias.sohn> |
| Component: | UI | Assignee: | Project Inbox <egit.ui-inbox> |
| Status: | NEW --- | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | gunnar, jan.sievers, pnehrer, rsternberg |
| Version: | 0.11 | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
|
Description
Matthias Sohn
Comment by Jan Sievers (Tycho team): 2011/1/17 Sievers, Jan <jan.sievers@sap.com> hm. Bundle-SymbolicName should have been org.hamcrest.core, not org.hamcrest. So I don't know how it worked before (mabe this is a different hamcrest wrapper bundle coming from swtbot?). package org.hamcrest is a split package Export-Package: org.hamcrest;version="1.1.0";core=split;mandatory:=cor e,org.hamcrest.core;version="1.1.0",org.hamcrest.internal;version="1. 1.0";x-internal:=true which seems to cause major headaches, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=271348 http://groups.google.com/group/hamcrest-dev/browse_thread/thread/3c2357667c5bc005?pli=1 To make things more complicated, the hamcrest packages are also re-exported by the junit 4 bundle. Did not go into the details but I would just use Require-Bundle to get around this. Or maybe try Import-Package: org.hamcrest;core=split Regards, Jan > From: Matthias Sohn [mailto:matthias.sohn@googlemail.com] > Sent: Montag, 17. Januar 2011 10:53 > To: Sievers, Jan > Subject: why does require-bundle work but import-package not > > We have changed our indirect dependency to bundle org.hamcrest needed by junit 4 > from require-bundle to import package [1], now the build in Eclipse still succeeds but > the tycho build fails [2]. Any idea what's the reason ? > > [1] http://egit.eclipse.org/r/#patch,unified,2253,2,org.eclipse.egit.ui.test/META-INF/MANIFEST.MF > [2] https://hudson.eclipse.org/hudson/job/egit/913/console I just hit the same issue today while porting a larger project to Tycho. The issue is IMHO a Tycho issue.
My target definition file contains all the Hamcrest bundles from Orbit including their dependencies. The Target Platform State view in Eclipse show they resolve properly.
However, Tycho seems to only add "org.hamcrest.core" to the Equinox Resolver during resolution process. The Tycho debug output at least shows no signs about the other Hamcrest bundles.
> mvn clean compile -X
...
[DEBUG] Adding target definition file "...my-target-platform.target"
[DEBUG] Added 562 units, the content of the target definition file, to the target platform
[DEBUG] Registered artifact repository org.eclipse.tycho.repository.registry.facade.RepositoryBlackboardKey(uri=file:/resolution-context-artifacts@...)
[DEBUG] Added 11 locally built units to the target platform
[INFO] Resolving dependencies of MavenProject: ...:1.0.0-SNAPSHOT @ ...\pom.xml
[WARNING] The following locally built units have been used to resolve project dependencies:
[WARNING] org.apache.commons.csv/1.0.0.r678580_qualifier
[INFO] Resolving class path of MavenProject: ...:1.0.0-SNAPSHOT @ ...\pom.xml
[DEBUG] Equinox resolver state:
Resolved OSGi state
..
RESOLVED org.hamcrest.core_1.3.0.v201303031735 : ..\.m2\repository\p2\osgi\bundle\org.hamcrest.core\1.3.0.v201303031735\org.hamcrest.core-1.3.0.v201303031735.jar
...
[ERROR] -> [Help 1]
org.apache.maven.InternalErrorException: Internal error: java.lang.RuntimeException: org.osgi.framework.BundleException: Bundle ... cannot be resolved
Resolution errors:
Bundle ... - Missing Constraint: Import-Package: org.hamcrest; version="1.1.0"
(In reply to comment #2) > However, Tycho seems to only add "org.hamcrest.core" to the Equinox Resolver > during resolution process. The Tycho debug output at least shows no signs > about the other Hamcrest bundles. Confirmed the behavior with "org.eclipse.core.runtime" package. Created bug 403196 for Tycho investigation. |