mirror of https://github.com/apache/maven.git
[MNG-4834] [regression] MavenProject.getParent() ignores configured repositories
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@1001236 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
87d3ffae46
commit
759db789e1
|
@ -27,7 +27,6 @@ import java.util.Properties;
|
||||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||||
import org.apache.maven.model.Profile;
|
import org.apache.maven.model.Profile;
|
||||||
import org.apache.maven.model.building.ModelBuildingRequest;
|
import org.apache.maven.model.building.ModelBuildingRequest;
|
||||||
import org.apache.maven.repository.ArtifactTransferListener;
|
|
||||||
import org.sonatype.aether.RepositorySystemSession;
|
import org.sonatype.aether.RepositorySystemSession;
|
||||||
|
|
||||||
public class DefaultProjectBuildingRequest
|
public class DefaultProjectBuildingRequest
|
||||||
|
@ -62,8 +61,6 @@ public class DefaultProjectBuildingRequest
|
||||||
|
|
||||||
private boolean resolveDependencies;
|
private boolean resolveDependencies;
|
||||||
|
|
||||||
private ArtifactTransferListener transferListener;
|
|
||||||
|
|
||||||
public DefaultProjectBuildingRequest()
|
public DefaultProjectBuildingRequest()
|
||||||
{
|
{
|
||||||
processPlugins = true;
|
processPlugins = true;
|
||||||
|
@ -76,6 +73,25 @@ public class DefaultProjectBuildingRequest
|
||||||
pluginArtifactRepositories = new ArrayList<ArtifactRepository>();
|
pluginArtifactRepositories = new ArrayList<ArtifactRepository>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DefaultProjectBuildingRequest( ProjectBuildingRequest request )
|
||||||
|
{
|
||||||
|
this();
|
||||||
|
setProcessPlugins( request.isProcessPlugins() );
|
||||||
|
setProfiles( request.getProfiles() );
|
||||||
|
setActiveProfileIds( request.getActiveProfileIds() );
|
||||||
|
setInactiveProfileIds( request.getInactiveProfileIds() );
|
||||||
|
setSystemProperties( request.getSystemProperties() );
|
||||||
|
setUserProperties( request.getUserProperties() );
|
||||||
|
setRemoteRepositories( request.getRemoteRepositories() );
|
||||||
|
setPluginArtifactRepositories( request.getPluginArtifactRepositories() );
|
||||||
|
setRepositorySession( request.getRepositorySession() );
|
||||||
|
setLocalRepository( request.getLocalRepository() );
|
||||||
|
setBuildStartTime( request.getBuildStartTime() );
|
||||||
|
setProject( request.getProject() );
|
||||||
|
setResolveDependencies( request.isResolveDependencies() );
|
||||||
|
setValidationLevel( request.getValidationLevel() );
|
||||||
|
}
|
||||||
|
|
||||||
public MavenProject getProject()
|
public MavenProject getProject()
|
||||||
{
|
{
|
||||||
return project;
|
return project;
|
||||||
|
@ -274,16 +290,6 @@ public class DefaultProjectBuildingRequest
|
||||||
this.buildStartTime = buildStartTime;
|
this.buildStartTime = buildStartTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArtifactTransferListener getTransferListener()
|
|
||||||
{
|
|
||||||
return transferListener;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTransferListener( ArtifactTransferListener transferListener )
|
|
||||||
{
|
|
||||||
this.transferListener = transferListener;
|
|
||||||
}
|
|
||||||
|
|
||||||
public RepositorySystemSession getRepositorySession()
|
public RepositorySystemSession getRepositorySession()
|
||||||
{
|
{
|
||||||
return repositorySession;
|
return repositorySession;
|
||||||
|
|
|
@ -346,9 +346,12 @@ public class MavenProject
|
||||||
*/
|
*/
|
||||||
if ( parentFile != null )
|
if ( parentFile != null )
|
||||||
{
|
{
|
||||||
|
ProjectBuildingRequest request = new DefaultProjectBuildingRequest( projectBuilderConfiguration );
|
||||||
|
request.setRemoteRepositories( getRemoteArtifactRepositories() );
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
parent = mavenProjectBuilder.build( parentFile, projectBuilderConfiguration ).getProject();
|
parent = mavenProjectBuilder.build( parentFile, request ).getProject();
|
||||||
}
|
}
|
||||||
catch ( ProjectBuildingException e )
|
catch ( ProjectBuildingException e )
|
||||||
{
|
{
|
||||||
|
@ -360,9 +363,12 @@ public class MavenProject
|
||||||
}
|
}
|
||||||
else if ( model.getParent() != null )
|
else if ( model.getParent() != null )
|
||||||
{
|
{
|
||||||
|
ProjectBuildingRequest request = new DefaultProjectBuildingRequest( projectBuilderConfiguration );
|
||||||
|
request.setRemoteRepositories( getRemoteArtifactRepositories() );
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
parent = mavenProjectBuilder.build( getParentArtifact(), projectBuilderConfiguration ).getProject();
|
parent = mavenProjectBuilder.build( getParentArtifact(), request ).getProject();
|
||||||
}
|
}
|
||||||
catch ( ProjectBuildingException e )
|
catch ( ProjectBuildingException e )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue