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

Bug 340852

Summary: Building on Linux fails when there are symbolic links involved
Product: z_Archived Reporter: Danail Nachev <d.nachev>
Component: TychoAssignee: Jan Sievers <jan.sievers>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P3 CC: alexander.smirnoff, bimargulies, cedric.brun, jan.sievers, kai, robert.munteanu, t-oberlies
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Danail Nachev CLA 2011-03-24 09:25:48 EDT
I'm building a very simple Eclipse plugin with Tycho 0.10. The build is done through Hudson on a Ubuntu 10.10 machine.

At some point, Tycho fails with NPE:

mavenExecutionResult exceptions not empty
org.apache.maven.InternalErrorException: Internal error: java.lang.NullPointerException
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:168)
        ...
Caused by: java.lang.NullPointerException
	at org.codehaus.tycho.osgitools.EquinoxResolver.assertResolved(EquinoxResolver.java:248)
	at org.codehaus.tycho.osgitools.EquinoxResolver.newResolvedState(EquinoxResolver.java:58)
	at org.codehaus.tycho.osgitools.OsgiBundleProject.getResolverState(OsgiBundleProject.java:194)
	at org.codehaus.tycho.osgitools.OsgiBundleProject.resolve(OsgiBundleProject.java:142)
	at org.codehaus.tycho.resolver.DefaultTychoDependencyResolver.resolveProject(DefaultTychoDependencyResolver.java:80)
	at org.codehaus.tycho.maven.TychoMavenLifecycleParticipant.afterProjectsRead(TychoMavenLifecycleParticipant.java:94)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:273)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
	... 19 more

I've looked at the source and the problem relates that when Maven projects are added to the Tycho TargetPlatform, there are normalized (DefaultTargetPlatform.normalizeArtifact()), which essentially gets the canonical path of the artifact. Later in the process, EquinoxResolver.newResolvedState(MavenProject, TargetPlatform) tries to find the corresponding BundleDescription using the absolute path of the project.

If the project is inside symbolic linked folder (you need to execute the maven build via the symbolic link), then getAbsolutePath() will return different value from getCanonicalPath(), which causes the BundleDescription to be not found, which later causes NPE.

I'll try to workaround the symbolic link, but debugging this problem was hard.
Comment 1 Jan Sievers CLA 2011-04-06 14:50:16 EDT
originally reported as 

https://issues.sonatype.org/browse/TYCHO-575

this issue also has a proposed patch attached
Comment 2 Tobias Oberlies CLA 2011-06-11 06:56:22 EDT
@Igor: I assume you are only assignee, because you used to be the default assignee - and not because you are working on it. Reassigning to inbox.
Comment 3 Tobias Oberlies CLA 2011-06-11 06:58:32 EDT
*** Bug 348343 has been marked as a duplicate of this bug. ***
Comment 4 Jan Sievers CLA 2011-07-05 10:53:18 EDT
fixed with e4f4fd7