Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [tycho-user] tycho-demo pom first: the bundle except test bundle not started

Did you add Bundle-Activator and Bundle-ActivationPolicy to relevant
bundle manifests? For pom-first projects this should be done through
pom.xml configuration, check maven-bundle-plugin documentation for more
details.

If you really need to force start bundles during test execution, you can
do this with <bundleStartLevel> tycho-surefire-plugin configuration
parameter, something like

  ...
  <bundleStartLevel>
    <plugin>
      <id>...</id>
      <level>4</level>
      <autoStart>true</autoStart>
    </plugin>
  </bundleStartLevel>
  ...


--
Regards,
Igor

On 12-07-17 12:05 AM, Guofeng Zhang wrote:
Hi,

I clone the tycho demo application and tried itp02 for pom first dependency.

The demo works well following the instruction on
http://wiki.eclipse.org/Tycho/How_Tos/Dependency_on_pom-first_artifacts.

Now I make some modification to the demo. I let PomFirst and ITP02 to be
a registered service by its Activator. The IT02Test changed as the
following:

public class ITP02Test {

     @Test

     public void basic() {

         ITP02 testee = getITP02();

         Assert.assertEquals("maven-bundle-plugin", testee.getMessage());

     }

             private ITP02 getITP02() {

                             ServiceReference<ITP02> ref =
Activator.getContext().getServiceReference(ITP02.class ) ;

                             return Activator.getContext().getService(ref );

             }

}

When run the test by Maven, I got the following error:

Tests in error:

   basic(tycho.demo.itp02.bundle.tests.ITP02Test): A null service
reference is not allowed.

I think this is because pomfirst-bundle and tycho.demo.itp02.bundle are
not started (not console output from their activators), so the required
services are not registered.

I cannot figure out why the two bundles are not started, by analyzing
config.ini, the two bundles are listed in osgi.bundles, but without
@4:start.

How to solve this issue?

Thanks for your help.

Guofeng



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




Back to the top