You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Steven E. Harris" <se...@panix.com> on 2007/05/11 20:23:35 UTC

NPE in maven-bundle-plugin -- empty Export-Package directive

If I don't include an Export-Package directive in my
maven-bundle-plugin POM configuration section, the plugin (or BND)
complains that it can't find the default package it synthesizes.

If I attempt to silence it by putting in an empty Export-Package
declaration like so:

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <extensions>true</extensions>
        <configuration>
          <instructions>
            <Export-Package></Export-Package>
            <!-- ... -->
          </instructions>
        </configuration>
      </plugin>
    </plugins>
  </build>

the plugin dies with the following error:

,----
| java.lang.NullPointerException
|         at java.util.Hashtable.put(Hashtable.java:394)
|         at java.util.Hashtable.putAll(Hashtable.java:466)
|         at org.apache.felix.tools.maven2.bundleplugin.BundlePlugin.execute(BundlePlugin.java:151)
|         at org.apache.felix.tools.maven2.bundleplugin.BundlePlugin.execute(BundlePlugin.java:115)
|         at org.apache.felix.tools.maven2.bundleplugin.BundlePlugin.execute(BundlePlugin.java:110)
|         at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:420)
|         at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:539)
|         at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:480)
|         at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:459)
|         at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:311)
|         at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:278)
|         at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143)
|         at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:330)
|         at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:123)
|         at org.apache.maven.cli.MavenCli.main(MavenCli.java:272)
|         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)
`----

Is this a known problem?

As a workaround, I tried an Export-Package value of "!*", which
produced the following warning:

,----
| [INFO] [bundle:bundle]
| [WARNING] Warning building bundle
|           my.symbolic.name:bundle:1.0.0-SNAPSHOT :
|           Did not find matching referal for !*
`----

What's the right way to ask for /no/ Export-Package (or
Import-Package) declaration?

-- 
Steven E. Harris

Re: NPE in maven-bundle-plugin -- empty Export-Package directive

Posted by "Steven E. Harris" <se...@panix.com>.
"Stuart McCulloch" <st...@jayway.net> writes:

> If the Spring team haven't already opened a JIRA issue, please raise
> one for the maven-bundle-plugin component.

I couldn't find one, so I filed FELIX-281:

  http://issues.apache.org/jira/browse/FELIX-281

-- 
Steven E. Harris

Re: NPE in maven-bundle-plugin -- empty Export-Package directive

Posted by Stuart McCulloch <st...@jayway.net>.
Looks like the same problem recently found by Costin.

Basically the map of instructions from maven contains a
null value which causes an exception when it is put into
the properties object (which, as a hashtable, doesn't like
null values).

We could handle null values in the "transformDirectives"
private method (perhaps map them to the empty string?)

If the Spring team haven't already opened a JIRA issue,
please raise one for the maven-bundle-plugin component.

On 11/05/07, Steven E. Harris <se...@panix.com> wrote:
> If I don't include an Export-Package directive in my
> maven-bundle-plugin POM configuration section, the plugin (or BND)
> complains that it can't find the default package it synthesizes.
>
> If I attempt to silence it by putting in an empty Export-Package
> declaration like so:
>
>   <build>
>     <plugins>
>       <plugin>
>         <groupId>org.apache.felix</groupId>
>         <artifactId>maven-bundle-plugin</artifactId>
>         <extensions>true</extensions>
>         <configuration>
>           <instructions>
>             <Export-Package></Export-Package>
>             <!-- ... -->
>           </instructions>
>         </configuration>
>       </plugin>
>     </plugins>
>   </build>
>
> the plugin dies with the following error:
>
> ,----
> | java.lang.NullPointerException
> |         at java.util.Hashtable.put(Hashtable.java:394)
> |         at java.util.Hashtable.putAll(Hashtable.java:466)
> |         at org.apache.felix.tools.maven2.bundleplugin.BundlePlugin.execute(BundlePlugin.java:151)
> |         at org.apache.felix.tools.maven2.bundleplugin.BundlePlugin.execute(BundlePlugin.java:115)
> |         at org.apache.felix.tools.maven2.bundleplugin.BundlePlugin.execute(BundlePlugin.java:110)
> |         at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:420)
> |         at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:539)
> |         at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:480)
> |         at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:459)
> |         at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:311)
> |         at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:278)
> |         at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143)
> |         at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:330)
> |         at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:123)
> |         at org.apache.maven.cli.MavenCli.main(MavenCli.java:272)
> |         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)
> `----
>
> Is this a known problem?
>
> As a workaround, I tried an Export-Package value of "!*", which
> produced the following warning:
>
> ,----
> | [INFO] [bundle:bundle]
> | [WARNING] Warning building bundle
> |           my.symbolic.name:bundle:1.0.0-SNAPSHOT :
> |           Did not find matching referal for !*
> `----
>
> What's the right way to ask for /no/ Export-Package (or
> Import-Package) declaration?
>
> --
> Steven E. Harris
>


-- 
Cheers, Stuart