You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Michael Osipov (Jira)" <ji...@apache.org> on 2023/02/05 12:47:00 UTC
[jira] [Closed] (MNG-7544) MavenMetadataSource#retrieve(MetadataResolutionRequest) does not check for null when reading from project map
[ https://issues.apache.org/jira/browse/MNG-7544?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Michael Osipov closed MNG-7544.
-------------------------------
Resolution: Fixed
Fixed with [0525d90d428e0be31c30f0aad68b078a7e2e6ce3|https://gitbox.apache.org/repos/asf?p=maven.git;a=commit;h=0525d90d428e0be31c30f0aad68b078a7e2e6ce3], with [72efba9b1455a02c416a0e605dfa99f31f4e564a|https://gitbox.apache.org/repos/asf?p=maven.git;a=commit;h=72efba9b1455a02c416a0e605dfa99f31f4e564a] for {{maven-3.9.x}} branch, with [c91447929b282fcb5346f13aeba8e783ac514e22|https://gitbox.apache.org/repos/asf?p=maven.git;a=commit;h=c91447929b282fcb5346f13aeba8e783ac514e22] for {{maven-3.8.x}} branch.
> MavenMetadataSource#retrieve(MetadataResolutionRequest) does not check for null when reading from project map
> -------------------------------------------------------------------------------------------------------------
>
> Key: MNG-7544
> URL: https://issues.apache.org/jira/browse/MNG-7544
> Project: Maven
> Issue Type: Bug
> Affects Versions: 3.8.7
> Reporter: Christoph Läubrich
> Assignee: Michael Osipov
> Priority: Major
> Fix For: 4.0.0, 4.0.0-alpha-5, 3.8.8, 3.9.1
>
>
> At Tycho we see
> {code:java}
> [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
> {code}
> 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()
--
This message was sent by Atlassian Jira
(v8.20.10#820010)