Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
3.8.7
-
None
Description
At Tycho we see
[ERROR] Internal error: java.lang.NullPointerException: Cannot invoke "org.apache.maven.project.MavenProject.getRemoteArtifactRepositories()" because "project" is null -> [Help 1] org.apache.maven.InternalErrorException: Internal error: java.lang.NullPointerException: Cannot invoke "org.apache.maven.project.MavenProject.getRemoteArtifactRepositories()" because "project" is null at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:120) at org.apache.maven.cli.MavenCli.execute (MavenCli.java:960) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293) at org.apache.maven.cli.MavenCli.main (MavenCli.java:196) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77) at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke (Method.java:568) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282) at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406) at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347) Caused by: java.lang.NullPointerException: Cannot invoke "org.apache.maven.project.MavenProject.getRemoteArtifactRepositories()" because "project" is null at org.apache.maven.project.artifact.MavenMetadataSource.retrieve (MavenMetadataSource.java:200) at org.apache.maven.repository.legacy.resolver.DefaultLegacyArtifactCollector.recurse (DefaultLegacyArtifactCollector.java:551) at org.apache.maven.repository.legacy.resolver.DefaultLegacyArtifactCollector.collect (DefaultLegacyArtifactCollector.java:148) at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve (DefaultArtifactResolver.java:504) at org.apache.maven.repository.legacy.LegacyRepositorySystem.resolve (LegacyRepositorySystem.java:367) at org.eclipse.tycho.osgi.configuration.MavenDependenciesResolverConfigurer.resolve (MavenDependenciesResolverConfigurer.java:106) at org.eclipse.tycho.core.shared.MavenDependenciesResolver.resolve (MavenDependenciesResolver.java:58) at org.eclipse.tycho.p2.resolver.MavenTargetDefinitionContent.<init> (MavenTargetDefinitionContent.jav
This is because MavenMetadataSource assumes that if the model is read from a workspace model reader there is always a reactor project in the sessions project map, but this is not always true.
An obvious fix would be to simply assume there are no pomRepositories in such a case, or even query the Model itself with model.getRepositories()