Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[m2e-dev] Required bundles to run m2e in a JUnit plug-in Test

Hi,

I am writing some tests for my plug-in and trying to enable m2e so
that I can convert the projects created in tests to m2e projects.

>From an API point of view, that was pretty easy as I used
org.eclipse.m2e.core.ui.internal.actions.EnableNatureAction . However,
when launching the test from Eclipse m2e is not properly configured
and the test fails. The first logged error is

INFO: An exception was caught and reported. Message:
java.lang.NullPointerException
java.lang.NullPointerException
    at org.eclipse.m2e.core.internal.embedder.ExtensionModule.configure(ExtensionModule.java:44)
    at com.google.inject.AbstractModule.configure(AbstractModule.java:62)
    at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:230)
    at org.codehaus.plexus.DefaultPlexusContainer$BootModule.configure(DefaultPlexusContainer.java:815)
    at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:230)
    at com.google.inject.spi.Elements.getElements(Elements.java:103)
    at com.google.inject.spi.Elements.getElements(Elements.java:94)
    at org.eclipse.sisu.wire.WireModule.configure(WireModule.java:75)
    at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:230)
    at com.google.inject.spi.Elements.getElements(Elements.java:103)
    at com.google.inject.internal.InjectorShell$Builder.build(InjectorShell.java:136)
    at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:104)
    at com.google.inject.Guice.createInjector(Guice.java:96)
    at com.google.inject.Guice.createInjector(Guice.java:73)
    at com.google.inject.Guice.createInjector(Guice.java:62)
    at org.codehaus.plexus.DefaultPlexusContainer.addPlexusInjector(DefaultPlexusContainer.java:477)
    at org.codehaus.plexus.DefaultPlexusContainer.<init>(DefaultPlexusContainer.java:203)
    at org.eclipse.m2e.core.internal.embedder.MavenImpl.newPlexusContainer(MavenImpl.java:1311)
    at org.eclipse.m2e.core.internal.embedder.MavenImpl.getPlexusContainer0(MavenImpl.java:1229)
    at org.eclipse.m2e.core.internal.embedder.MavenImpl.getPlexusContainer(MavenImpl.java:1220)
    at org.eclipse.m2e.core.internal.embedder.MavenImpl.lookup(MavenImpl.java:1279)
    at org.eclipse.m2e.core.internal.embedder.MavenImpl.getSettings(MavenImpl.java:464)
    at org.eclipse.m2e.core.internal.embedder.MavenImpl.getSettings(MavenImpl.java:436)
    at org.eclipse.m2e.core.internal.repository.RepositoryRegistry.updateRegistry(RepositoryRegistry.java:223)
    at org.eclipse.m2e.core.internal.repository.RepositoryRegistryUpdateJob.run(RepositoryRegistryUpdateJob.java:47)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

I have pulled in all m2e bundles from my target platform into my test
fragment using

Require-Bundle: org.junit,
  org.eclipse.m2e.core,
  org.eclipse.m2e.launching,
  org.eclipse.m2e.jdt,
  org.eclipse.m2e.core.ui,
  org.eclipse.m2e.discovery,
  org.eclipse.m2e.editor,
  org.eclipse.m2e.editor.xml,
  org.eclipse.m2e.maven.indexer,
  org.eclipse.m2e.archetype.common,
  org.eclipse.m2e.profiles.ui,
  org.eclipse.m2e.scm,
  org.eclipse.m2e.maven.runtime,
  org.eclipse.m2e.lifecyclemapping.defaults,
  org.eclipse.m2e.model.edit,
  org.eclipse.m2e.maven.runtime.slf4j.simple,
  org.eclipse.m2e.refactoring,
  org.eclipse.m2e.profiles.core

How can I make sure m2e is properly set up in my plug-in test?

Thanks,

Robert

-- 
http://robert.muntea.nu/


Back to the top