felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephen Evanchik <evanc...@gmail.com>
Subject Re: NullPointerException in maven-bundle-plugin:3.0.1
Date Mon, 01 Feb 2016 15:35:59 GMT
Hi Stuart,

I was looking at some parallel builds we ran over the weekend and notice
some failures. I started to track them down and noticed that there was a
very strange error message which seems to indicate that maven-bundle-plugin
is not thread safe or has a fairly serious bug:

[ERROR] Failed to execute goal
org.apache.felix:maven-bundle-plugin:3.0.1:manifest (bundle-manifest) on
project PROJECT_A: Execution bundle-manifest of goal
org.apache.felix:maven-bundle-plugin:3.0.1:manifest failed: A Jar can only
accept a valid file or directory: /full/build/path/PROJECT_B/target/classes

There is a compile dependency between the projects (PROJECT_A depends on
PROJECT_B) but it looks like PROJECT_B was not yet built.

Stephen



On Thu, Jan 28, 2016 at 8:37 PM, Stephen Evanchik <evanchsa@gmail.com>
wrote:

> Hi Stuart,
>
> A final update for tonight: I was able to reproduce the problem with
> maven-bundle-plugin:3.0.0 but not with maven-bundle-plugin:2.5.4 even
> though it looks like the DefaultDependencyGraphBuilder is in all three
> versions.
>
> Stephen
>
> On Thu, Jan 28, 2016 at 6:18 PM, Stephen Evanchik <evanchsa@gmail.com>
> wrote:
>
>> Hi Stuart,
>>
>> Thanks for confirming the behavior. I too noticed the redundant packaging
>> and execution stanzas. I suspect the original developer that added this
>> project didn't understand how the bundle extension worked.
>>
>> When I noticed the redundancy I updated all of the projects to use the
>> <execution>/<package> jar  pattern hoping that the problem would go away.
>> Unfortunately, I saw an improvement but still have build failures.
>>
>> I'm not sure if this is a bug in Maven, maven-dependency-tree or,
>> maven-bundle-plugin
>>
>> Stephen
>>
>>
>> On Thu, Jan 28, 2016 at 5:43 PM, Stuart McCulloch <mcculls@gmail.com>
>> wrote:
>>
>>> Hi Stephen,
>>>
>>> I've been able to recreate this with Maven 3.3.9 (by cloning your example
>>> project several times in a multi-module project) - will investigate
>>> further
>>> over the weekend.
>>>
>>> I did notice you're using the 'bundle' packaging, but you also have an
>>> explicit execution of the 'bundle' goal which should already be covered
>>> by
>>> the 'bundle' packaging's lifecycle - is there a reason for this extra
>>> execution?
>>> On 28 Jan 2016 18:00, "Stephen Evanchik" <evanchsa@gmail.com> wrote:
>>>
>>> > Hi Stuart,
>>> >
>>> > I am using Maven 3.3.3 please disregard my earlier email. I did see
>>> this
>>> > problem in 3.3.1 so there doesn't seem to be a difference. I am going
>>> to
>>> > try with 3.3.9 but I'm not going to hold out hope that it will make a
>>> > difference.
>>> >
>>> > I think the problem is that DefaultDependencyGraphBuilder does not get
>>> > initialized properly. This only occurs in parallel builds and is
>>> strongly
>>> > associated with relative timing. For example, if I issue a mvn -T2.0C
>>> > install I will see the failure >80% of the time but if I use mvn -X
>>> -T2.0C
>>> > I cannot reproduce the failure at all.
>>> >
>>> > I'm not sure embedding a pom is the right approach but here's a pastbin
>>> > link to a sample project that fails:
>>> >
>>> > https://paste.apache.org/dpeQ
>>> >
>>> >
>>> > Stephen
>>> >
>>> >
>>> > On Wed, Jan 27, 2016 at 4:49 AM, Stuart McCulloch <mcculls@gmail.com>
>>> > wrote:
>>> >
>>> > > On Wednesday, 27 January 2016 at 06:03, Stephen Evanchik wrote:
>>> > > > Hi everyone,
>>> > > >
>>> > > > I'm having trouble tracking down an intermittent but frequent
build
>>> > > failure
>>> > > > using the maven-bundle-plugin to wrap non-OSGi projects. I'm using
>>> > Maven
>>> > > > 3.3.1 and see the following NPE:
>>> > > >
>>> > > > Caused by: java.lang.NullPointerException
>>> > > > at
>>> > > >
>>> > >
>>> >
>>> org.apache.maven.shared.dependency.graph.internal.DefaultDependencyGraphBuilder.buildDependencyGraph(DefaultDependencyGraphBuilder.java:60)
>>> > > > at
>>> > > >
>>> > >
>>> >
>>> org.apache.felix.bundleplugin.BundlePlugin.buildDependencyGraph(BundlePlugin.java:334)
>>> > > > at
>>> > > >
>>> >
>>> org.apache.felix.bundleplugin.BundlePlugin.execute(BundlePlugin.java:359)
>>> > > > at
>>> > > >
>>> > >
>>> >
>>> org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
>>> > > > ... 11 more
>>> > > >
>>> > > > whenever I invoke a parallel build (-T2.0C for example).
>>> > > >
>>> > > > There are many projects that will fail with this exception. I
can
>>> > > provide a
>>> > > > fairly simple one if that makes sense.
>>> > > >
>>> > > >
>>> > >
>>> > > a reproducible test project is always helpful - have you tried a more
>>> > > recent version of Maven like 3.3.3 or 3.3.9 to see if that helps?
>>> > > > It looks like the 3.0.1 version is using maven-dependency-tree-2.1
>>> > whose
>>> > > > buildDependency method looks like:
>>> > > >
>>> > > > public DependencyNode buildDependencyGraph( MavenProject project,
>>> > > > ArtifactFilter filter )
>>> > > > throws DependencyGraphBuilderException
>>> > > > {
>>> > > > try
>>> > > > {
>>> > > > String hint = isMaven31() ? "maven31" : isMaven2x() ? "maven2"
>>> > > > : "maven3";
>>> > > > getLogger().debug( "building " + hint + " dependency graph for
>>> > > > " + project.getId() );
>>> > > >
>>> > > > DependencyGraphBuilder effectiveGraphBuilder =
>>> > > > (DependencyGraphBuilder) container.lookup(
>>> > > > DependencyGraphBuilder.class.getCanonicalName(), hint );
>>> > > >
>>> > > >
>>> > > > where the NPE is on:
>>> > > >
>>> > > > DependencyGraphBuilder effectiveGraphBuilder =
>>> > > > (DependencyGraphBuilder) container.lookup(
>>> > > > DependencyGraphBuilder.class.getCanonicalName(), hint );
>>> > > >
>>> > > >
>>> > > > I'm not sure why this could NPE as it seems like the
>>> > > > Contextualizable.contextualize() is called successfully for other
>>> > > projects
>>> > > > in the build.
>>> > > >
>>> > > > Any ideas on how to track this down? I can't enable debugging
(mvn
>>> -X)
>>> > > > because that affects the timing just enough to avoid the issue.
>>> > > >
>>> > > > Thanks,
>>> > > > Stephen
>>> > >
>>> > >
>>> > >
>>> >
>>> >
>>> > --
>>> > Stephen Evanchik
>>> > http://stephen.evanchik.com
>>> >
>>>
>>
>>
>>
>> --
>> Stephen Evanchik
>> http://stephen.evanchik.com
>>
>
>
>
> --
> Stephen Evanchik
> http://stephen.evanchik.com
>



-- 
Stephen Evanchik
http://stephen.evanchik.com

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message