[ 
https://issues.apache.org/jira/browse/MNG-7544?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17607702#comment-17607702
 ] 

ASF GitHub Bot commented on MNG-7544:
-------------------------------------

laeubi opened a new pull request, #805:
URL: https://github.com/apache/maven/pull/805

   Currently, if a project is returned from the workspace reader but is not 
part of the reactor, a NPE occurs. In this case, the repositories are instead 
read from the model instead.
   
   Following this checklist to help us incorporate your
   contribution quickly and easily:
   
    - [x] Make sure there is a [JIRA 
issue](https://issues.apache.org/jira/browse/MNG-7544) filed
          for the change (usually before you start working on it).  Trivial 
changes like typos do not
          require a JIRA issue. Your pull request should address just this 
issue, without
          pulling in other changes.
    - [x] Each commit in the pull request should have a meaningful subject line 
and body.
    - [x] Format the pull request title like `[MNG-XXX] SUMMARY`, where you 
replace `MNG-XXX`
          and `SUMMARY` with the appropriate JIRA issue. Best practice is to 
use the JIRA issue
          title in the pull request title and in the first line of the commit 
message.
    - [x] Write a pull request description that is detailed enough to 
understand what the pull request does, how, and why.
    - [ ] Run `mvn clean verify` to make sure basic checks pass. A more 
thorough check will
          be performed on your pull request automatically.
    - [ ] You have run the [Core IT][core-its] successfully.
   
   If your pull request is about ~20 lines of code you don't need to sign an
   [Individual Contributor License 
Agreement](https://www.apache.org/licenses/icla.pdf) if you are unsure
   please ask on the developers list.
   
   To make clear that you license your contribution under
   the [Apache License Version 2.0, January 
2004](http://www.apache.org/licenses/LICENSE-2.0)
   you have to acknowledge this by using the following check-box.
   
    - [x] I hereby declare this contribution to be licenced under the [Apache 
License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
   
    - [ ] In any other case, please file an [Apache Individual Contributor 
License Agreement](https://www.apache.org/licenses/icla.pdf).
   
   [core-its]: https://maven.apache.org/core-its/core-it-suite/
   




> MavenMetadataSource.retrieve(MetadataResolutionRequest) do 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
>            Reporter: Christoph Läubrich
>            Priority: Major
>
> 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)

Reply via email to