[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[p2-dev] p2 publisher ant task NPE when it runs outside Eclipse IDE

Hello Everybody,

I'd like to run p2 publisher ant task (o.e.e.i.p.p.a.FeaturesAndBundlesPublisherTask) to publish some of our project bundles to p2 repositories.

Our project is based on Maven and we build our OSGi bundles outside any IDE from command line (or on our build machine with Apache Continuum).

I've tried to develop Ant script inside maven-antrun-plugin to publish our OSGi bundles. I added such libraries for p2-publisher ant task classpath:
- osgi core JAR
- osgi cmpn JAR
- org.eclipse.equinox.common_3.6.0.v20100222.jar
- org.eclipse.equinox.p2.core_2.0.0.v20100304.jar
- org.eclipse.equinox.p2.metadata_2.0.0.v20100311-1843.jar
- org.eclipse.equinox.p2.publisher_1.1.0.v20100310-1731.jar
- org.eclipse.equinox.p2.repository_2.0.0.v20100310-1731.jar
- publisher-ant.jar

The NPE is thrown during ant start:
#### Exception ####
org.apache.maven.lifecycle.LifecycleExecutionException: An Ant BuildException has occured: java.lang.NullPointerException
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:719)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:569)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:539)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
        at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoExecutionException: An Ant BuildException has occured: java.lang.NullPointerException
        at org.apache.maven.plugin.antrun.AbstractAntMojo.executeTasks(AbstractAntMojo.java:131)
        at org.apache.maven.plugin.antrun.AntRunMojo.execute(AntRunMojo.java:98)
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
        ... 17 more
Caused by: java.lang.NullPointerException
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:116)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:357)
        at org.apache.maven.plugin.antrun.AbstractAntMojo.executeTasks(AbstractAntMojo.java:118)
        ... 20 more
Caused by: java.lang.NullPointerException
        at org.eclipse.equinox.p2.publisher.Publisher.getService(Publisher.java:166)
        at org.eclipse.equinox.p2.publisher.Publisher.loadArtifactRepository(Publisher.java:140)
        at org.eclipse.equinox.p2.publisher.Publisher.createArtifactRepository(Publisher.java:105)
        at org.eclipse.equinox.internal.p2.publisher.ant.AbstractPublishTask.initializeRepositories(AbstractPublishTask.java:115)
        at org.eclipse.equinox.internal.p2.publisher.ant.FeaturesAndBundlesPublisherTask.execute(FeaturesAndBundlesPublisherTask.java:30)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        ... 23 more
#### Exception ####


After stack trace analyzing I found that the cause of error is missing of IProvisioningAgent service in BundleContext. BundleContext is not initialized also as any OSGi framework is started.

Questions:
1. Is it possible to run p2 publisher ant tasks outside Eclipse IDE?
2. Are any other ways to publish bundles except Eclipse IDE Wizards and p2 ant scripts?

Thank you in advance.


Best regards,
Dmytro Pishchukhin