Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [tycho-user] Tycho not finding some dependencies during integration testing

Tonny, 

Thanks for your answer.  I hadn't realized that my problem was with mockito in particular.  I though it was my testing setup.  Looking deeper into it I was able to  get it working on a very simple setup just by adding a required bundle (mockito's manifest doesn't require it, it just imports it). I'll keep your info at hand in case I run into more problems.  I also ran into this question which seems to be related, but with a different solution: http://stackoverflow.com/questions/18122834/which-dependencies-do-i-need-to-use-mockito-and-junit-in-an-eclipse-rcp-tycho-pr

In the end my MANIFEST.MF looks like this:

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Tests Plug-in
Bundle-SymbolicName: tycho.demo.itp01.tests
Bundle-Version: 1.0.0.qualifier
Fragment-Host: tycho.demo.itp01;bundle-version="1.0.0"
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Require-Bundle: org.junit4, 
 org.eclipse.ui,
 org.mockito;bundle-version="1.8.4",
 org.hamcrest;bundle-version="1.1.0"
 

Andres


On Tue, Feb 4, 2014 at 4:58 AM, Tonny Madsen <tonny.madsen@xxxxxxxxx> wrote:
Andres,

I have just been through the very same issue.

The problem is due to a split package (org.hamcrest) between o.h.core and o.h.library but Mockito does not specify this in the import., so if you use both of the Hamcrest bundles in your application - and you often do - then you're in for trouble...

I ended up resolving this with a special bundle that combines the two packages and re-exports all the packages. The MANIFEST.MF is listed below. Note that there are absolutely no code in the bundle, so it just consists of the manifest.

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: AGETOR 5: Combination of Hamcrest Core and Hamcrest Library
Bundle-SymbolicName: com.agetor.core.hamcrest.combined
Bundle-Version: 1.3.0.qualifier
Bundle-Vendor: Bording Data A/S
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Export-Package: org.hamcrest;version="1.3.0",
 org.hamcrest.beans;version="1.3.0",
 org.hamcrest.collection;version="1.3.0",
 org.hamcrest.core;version="1.3.0",
 org.hamcrest.integration;version="1.3.0",
 org.hamcrest.internal;version="1.3.0",
 org.hamcrest.number;version="1.3.0",
 org.hamcrest.object;version="1.3.0",
 org.hamcrest.text;version="1.3.0",
 org.hamcrest.xml;version="1.3.0"
Require-Bundle: org.hamcrest.core;bundle-version="1.3.0",
 org.hamcrest.library;bundle-version="1.3.0"


This really is a terrible hack, but the Hamcrest team seems to think the use of non-sealed packages in Java is a good thing and is there to be used ;-) Unfortunately, these does not play well in the OSGi environment. (I believe I found the above solution on bugzilla, though I lost the reference).

/Tonny

--
Tonny Madsen
My profiles: LinkedIn Twitter Blogger SlideShare



On 4 February 2014 02:20, Andres Olarte <olarte.andres@xxxxxxxxx> wrote:
I have created a plugin fragment.  However, when running test fragment it seems to fail due to missing dependencies.  For example:

    !ENTRY org.eclipse.osgi 2 0 2014-02-03 20:00:42.034
    !MESSAGE One or more bundles are not resolved because the following root constraints are not resolved:
    !SUBENTRY 1 org.eclipse.osgi 2 0 2014-02-03 20:00:42.034
    !MESSAGE Bundle initial@reference:file:C:/Users/andres/.m2/repository/p2/osgi/bundle/org.mockito/1.8.4.v201303031500/org.mockito-1.8.4.v201303031500.jar/ was not resolved.
    !SUBENTRY 2 org.mockito 2 0 2014-02-03 20:00:42.034
    !MESSAGE Missing imported package org.hamcrest_[1.0.0,2.0.0).

If I remove the test fragment, tycho compiles and builds a working application.  The test fragment is marked to as packaging "eclipse-test-plugin".  I'm running tycho version 0.16.0 since I've had issues building the my applications as "eclipse-application" (which will be eventually migrated).  How can I trouble shoot this?

Thanks,

Andres

_______________________________________________
tycho-user mailing list
tycho-user@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/tycho-user



_______________________________________________
tycho-user mailing list
tycho-user@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/tycho-user



Back to the top