Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 342865

Summary: NPE when building
Product: z_Archived Reporter: Andrew Overholt <overholt>
Component: TychoAssignee: Jan Sievers <jan.sievers>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: akurtakov, caniszczyk, jan.sievers, sgehwolf
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
output of mvn -X -fae clean install
none
patch none

Description Andrew Overholt CLA 2011-04-14 12:08:00 EDT
When trying to build a branch of Linux Tools with <tycho-version>0.11.0</tycho-version>, I got an NPE like this:

org.apache.maven.InternalErrorException: Internal error: java.lang.NullPointerException
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:168)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:534)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:616)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: java.lang.NullPointerException
	at org.sonatype.tycho.p2.impl.publisher.P2GeneratorImpl.getPublisherActions(P2GeneratorImpl.java:127)
	at org.sonatype.tycho.p2.impl.publisher.AbstractMetadataGenerator.generateMetadata(AbstractMetadataGenerator.java:53)
	at org.sonatype.tycho.p2.impl.publisher.DefaultDependencyMetadataGenerator.generateMetadata(DefaultDependencyMetadataGenerator.java:36)
	at org.sonatype.tycho.p2.facade.P2TargetPlatformResolver.setupProjects(P2TargetPlatformResolver.java:111)
	at org.codehaus.tycho.resolver.DefaultTychoDependencyResolver.setupProject(DefaultTychoDependencyResolver.java:72)
	at org.codehaus.tycho.maven.TychoMavenLifecycleParticipant.afterProjectsRead(TychoMavenLifecycleParticipant.java:87)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:273)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
	... 11 more

I'll attach the full mvn -X log file.
Comment 1 Andrew Overholt CLA 2011-04-14 12:11:43 EDT
I just tried mv ~/.m2{,.bak} and a fresh 'mvn -fae clean install' and it failed again.
Comment 2 Andrew Overholt CLA 2011-04-14 12:12:14 EDT
Created attachment 193273 [details]
output of mvn -X -fae clean install
Comment 3 Andrew Overholt CLA 2011-04-14 12:14:29 EDT
I was using maven 3.0.2 but I just tried with 3.0.3 and the same error occurs.
Comment 4 Andrew Overholt CLA 2011-04-14 12:30:17 EDT
I've had this happen on hudson.eclipse.org now, too:

https://hudson.eclipse.org/hudson/job/cbi-linuxtools-Helios/415/console
Comment 5 Andrew Overholt CLA 2011-04-14 14:11:24 EDT
Steps to reproduce:

<ensure the mvn on your PATH resolves to a maven 3.0.2 or 3.0.3 download>
git clone git://git.eclipse.org/gitroot/linuxtools/org.eclipse.linuxtools.git linuxtools
cd linuxtools
mvn -fae clean install
Comment 6 Andrew Overholt CLA 2011-04-14 16:47:46 EDT
Oops, scratch comment #5.

Steps to reproduce:

<ensure the mvn on your PATH resolves to a maven 3.0.2 or 3.0.3 download>
git clone git://git.eclipse.org/gitroot/linuxtools/org.eclipse.linuxtools.git linuxtools
cd linuxtools
git checkout -b stable-0.7 origin/stable-0.7
mvn -fae clean install
Comment 7 Jan Sievers CLA 2011-04-15 07:21:47 EDT
admittedly the NPE is far from appropriate error handling here.

But the root cuase here is that modules

http://git.eclipse.org/c/linuxtools/org.eclipse.linuxtools.git/tree/profiling/org.eclipse.linuxtools.profiling-feature?h=stable-0.7 

and

http://git.eclipse.org/c/linuxtools/org.eclipse.linuxtools.git/tree/profiling/org.eclipse.linuxtools.profiling.test-feature?h=stable-0.7


have a pom.xml with packaging type eclipse-feature, but there is no feature.xml in the module directory.

By commenting out these two modules in the reactor I can get past the NPEs.

The bottom line is we need to validate for existence of feature.xml in modules of packaging type eclipse-feature and create an appropriate error message if feature.xml is missing.
Comment 8 Jan Sievers CLA 2011-04-15 08:50:14 EDT
Created attachment 193362 [details]
patch

patch which validates feature.xml early.

TODO apply to master after we branched 0.12.x
Comment 9 Andrew Overholt CLA 2011-04-15 17:36:12 EDT
Thanks, Jan.  Sorry for it being an oversight on my part and I look forward to better error messages.
Comment 10 Jan Sievers CLA 2011-05-03 10:28:46 EDT
fixed with commit faf0ef2