Closed GoogleCodeExporter closed 8 years ago
Original comment by chriss....@gmail.com
on 18 Mar 2014 at 7:41
Attachments:
>sample-project.zip
contains the "test" project to reproduce the error and org.hamcrest.library
modified for powermock
>PowerMock-Target.zip
contains all neccessary bundles to launch the "test" project, it can be used as
target
Original comment by chriss....@gmail.com
on 18 Mar 2014 at 7:44
I tested a bit more, it seems to be a problem with org.hamcrest.library!
@PrepareForTest(Final.class)
@RunWith(PowerMockRunner.class)
public class Test {
@Test
public void test() throws Exception {
org.hamcrest.core.Is.is(""); //<- OK bundle: org.hamcrest.core
org.hamcrest.Matchers.is(""); //<- FAILS bundle: org.hamcrest.library
}
}
I doesn't work even when i add
Eclipse-BuddyPolicy: global,app,ext,boot
DynamicImport-Package: *
to the MANIFEST of org.hamcrest.library.
Original comment by chriss....@gmail.com
on 18 Mar 2014 at 8:19
I guess this is a problem with my "hacked" hamcrest bundle. Or it is actually
the "non best practice" split up of hamcrest libraries. I have to export the
org.hamcrest package in my hamcrest bundle as split package, otherwise the
org.hamcrest package of the org.hamcrest.library will not get exported.
Please try the following, if you have time (or I will try it later):
- download the powermock-osgi sources
- update the
https://code.google.com/p/powermock-osgi/source/browse/trunk/dependencies/hamcre
st-core/pom.xml to contain this:
<Export-Package>
org.hamcrest;-split-package:=merge-last,
org.hamcrest.core
</Export-Package>
- Build the powermock-osgi update site with the following two commands:
ROOT>mvn clean install
ROOT/p2>mvn clean install
- Delete the bundle pools in your eclipse
- Replace the URL with a local zip update site from the target folder of the
p2/repository inside your target file
- try again
I can try it later. If you have success let me know, and I will rebuild a new
update site.
Original comment by gabor.li...@gmail.com
on 18 Mar 2014 at 10:03
I tried something similar(?) in the MF of org.hamcrest.core:
i replaced -> Export-Package:
org.hamcrest;library=split;version="1.3.0";mandatory:=library,
with -> Export-Package: org.hamcrest;version="1.3.0",
Now it works!
Original comment by chriss....@gmail.com
on 18 Mar 2014 at 10:44
Super. I will update the update site as soon as I have time.
Original comment by gabor.li...@gmail.com
on 18 Mar 2014 at 11:49
I created a new update site at
http://powermock-osgi.googlecode.com/svn/updateSite/1.5.4.1
Changes:
- Hamcrest declares org.hamcrest as split package
- Junit and mockito refers this "split package" part, and not the whole package.
I tried to make your test project working without success. Please try again
with the new update site. Be sure to use my Junit and Mockito version.
Original comment by gabor.li...@gmail.com
on 19 Mar 2014 at 11:43
And define the org.hamcrest also split in your hamcrest library bundle
Original comment by gabor.li...@gmail.com
on 19 Mar 2014 at 11:44
See this comment as a real explanation for split packages.
http://eclipsesource.com/blogs/2008/08/22/tip-split-packages-and-visibility/comm
ent-page-1/#comment-649
Earlier I could not understand what "library" and "core" stands for. Now it is
clear. It is needed when someone want to depend on a split package part, for
example the "core" part of org.hamcrest package.
Original comment by gabor.li...@gmail.com
on 19 Mar 2014 at 11:48
Fixed in 1.5.4.1 update site.
Original comment by gabor.li...@gmail.com
on 21 Mar 2014 at 10:35
Original issue reported on code.google.com by
chriss....@gmail.com
on 18 Mar 2014 at 7:37