mirror of https://github.com/apache/maven.git
o Fixed lazy repo creation to cache result repo
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@1021505 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
947973e857
commit
f5ad9a458a
|
@ -1844,43 +1844,59 @@ public class MavenProject
|
|||
|
||||
protected ArtifactRepository getReleaseArtifactRepository()
|
||||
{
|
||||
if ( getDistributionManagement() != null && getDistributionManagement().getRepository() != null )
|
||||
if ( releaseArtifactRepository == null )
|
||||
{
|
||||
try
|
||||
{
|
||||
ArtifactRepository repo =
|
||||
repositorySystem.buildArtifactRepository( getDistributionManagement().getRepository() );
|
||||
repositorySystem.injectProxy( projectBuilderConfiguration.getRepositorySession(), Arrays.asList( repo ) );
|
||||
repositorySystem.injectAuthentication( projectBuilderConfiguration.getRepositorySession(),
|
||||
Arrays.asList( repo ) );
|
||||
setReleaseArtifactRepository( repo );
|
||||
}
|
||||
catch ( InvalidRepositoryException e )
|
||||
if ( getDistributionManagement() != null && getDistributionManagement().getRepository() != null )
|
||||
{
|
||||
try
|
||||
{
|
||||
ArtifactRepository repo =
|
||||
repositorySystem.buildArtifactRepository( getDistributionManagement().getRepository() );
|
||||
repositorySystem.injectProxy( projectBuilderConfiguration.getRepositorySession(),
|
||||
Arrays.asList( repo ) );
|
||||
repositorySystem.injectAuthentication( projectBuilderConfiguration.getRepositorySession(),
|
||||
Arrays.asList( repo ) );
|
||||
setReleaseArtifactRepository( repo );
|
||||
}
|
||||
catch ( InvalidRepositoryException e )
|
||||
{
|
||||
if ( logger != null )
|
||||
{
|
||||
logger.debug( "Failed to create release distribution repository for " + getId(), e );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return releaseArtifactRepository;
|
||||
}
|
||||
|
||||
protected ArtifactRepository getSnapshotArtifactRepository()
|
||||
{
|
||||
if ( getDistributionManagement() != null && getDistributionManagement().getSnapshotRepository() != null )
|
||||
if ( snapshotArtifactRepository == null )
|
||||
{
|
||||
try
|
||||
{
|
||||
ArtifactRepository repo =
|
||||
repositorySystem.buildArtifactRepository( getDistributionManagement().getSnapshotRepository() );
|
||||
repositorySystem.injectProxy( projectBuilderConfiguration.getRepositorySession(), Arrays.asList( repo ) );
|
||||
repositorySystem.injectAuthentication( projectBuilderConfiguration.getRepositorySession(),
|
||||
Arrays.asList( repo ) );
|
||||
setSnapshotArtifactRepository( repo );
|
||||
}
|
||||
catch ( InvalidRepositoryException e )
|
||||
if ( getDistributionManagement() != null && getDistributionManagement().getSnapshotRepository() != null )
|
||||
{
|
||||
try
|
||||
{
|
||||
ArtifactRepository repo =
|
||||
repositorySystem.buildArtifactRepository( getDistributionManagement().getSnapshotRepository() );
|
||||
repositorySystem.injectProxy( projectBuilderConfiguration.getRepositorySession(),
|
||||
Arrays.asList( repo ) );
|
||||
repositorySystem.injectAuthentication( projectBuilderConfiguration.getRepositorySession(),
|
||||
Arrays.asList( repo ) );
|
||||
setSnapshotArtifactRepository( repo );
|
||||
}
|
||||
catch ( InvalidRepositoryException e )
|
||||
{
|
||||
if ( logger != null )
|
||||
{
|
||||
logger.debug( "Failed to create snapshot distribution repository for " + getId(), e );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return snapshotArtifactRepository;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue