mirror of https://github.com/apache/maven.git
[MNG-7564] Check if session is null when generating metadata
Closes #857.
This commit is contained in:
parent
9beb2ed45d
commit
bc8c6be269
|
@ -196,12 +196,19 @@ public class MavenMetadataSource
|
||||||
DependencyManagement dependencyManagement = model.getDependencyManagement();
|
DependencyManagement dependencyManagement = model.getDependencyManagement();
|
||||||
managedDependencies = dependencyManagement == null ? null : dependencyManagement.getDependencies();
|
managedDependencies = dependencyManagement == null ? null : dependencyManagement.getDependencies();
|
||||||
MavenSession session = legacySupport.getSession();
|
MavenSession session = legacySupport.getSession();
|
||||||
|
if ( session != null )
|
||||||
|
{
|
||||||
pomRepositories = session.getProjects().stream()
|
pomRepositories = session.getProjects().stream()
|
||||||
.filter( p -> artifact.equals( p.getArtifact() ) )
|
.filter( p -> artifact.equals( p.getArtifact() ) )
|
||||||
.map( MavenProject::getRemoteArtifactRepositories )
|
.map( MavenProject::getRemoteArtifactRepositories )
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.orElseGet( ArrayList::new );
|
.orElseGet( ArrayList::new );
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pomRepositories = new ArrayList<>();
|
||||||
|
}
|
||||||
|
}
|
||||||
else if ( artifact instanceof ArtifactWithDependencies )
|
else if ( artifact instanceof ArtifactWithDependencies )
|
||||||
{
|
{
|
||||||
pomArtifact = artifact;
|
pomArtifact = artifact;
|
||||||
|
|
Loading…
Reference in New Issue