Add build method that can disable distributionManagement status for file that come from repository

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@312840 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Emmanuel Venisse 2005-10-11 08:45:12 +00:00
parent 342ce8cd02
commit 83b8cafc33
1 changed files with 18 additions and 6 deletions

View File

@ -167,7 +167,7 @@ public class DefaultMavenProjectBuilder
ProfileManager profileManager, TransferListener transferListener ) ProfileManager profileManager, TransferListener transferListener )
throws ProjectBuildingException, ArtifactResolutionException, ArtifactNotFoundException throws ProjectBuildingException, ArtifactResolutionException, ArtifactNotFoundException
{ {
MavenProject project = buildFromSourceFile( projectDescriptor, localRepository, profileManager ); MavenProject project = build( projectDescriptor, localRepository, profileManager );
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
// Typically when the project builder is being used from maven proper // Typically when the project builder is being used from maven proper
@ -265,11 +265,20 @@ public class DefaultMavenProjectBuilder
ProfileManager profileManager ) ProfileManager profileManager )
throws ProjectBuildingException throws ProjectBuildingException
{ {
return buildFromSourceFile( projectDescriptor, localRepository, profileManager ); return buildFromSourceFile( projectDescriptor, localRepository, profileManager, true );
}
public MavenProject build( File projectDescriptor, ArtifactRepository localRepository,
ProfileManager profileManager, boolean checkDistributionManagementStatus )
throws ProjectBuildingException
{
return buildFromSourceFile( projectDescriptor, localRepository, profileManager,
checkDistributionManagementStatus );
} }
private MavenProject buildFromSourceFile( File projectDescriptor, ArtifactRepository localRepository, private MavenProject buildFromSourceFile( File projectDescriptor, ArtifactRepository localRepository,
ProfileManager profileManager ) ProfileManager profileManager,
boolean checkDistributionManagementStatus )
throws ProjectBuildingException throws ProjectBuildingException
{ {
Model model = readModel( "unknown", projectDescriptor ); Model model = readModel( "unknown", projectDescriptor );
@ -283,10 +292,13 @@ public class DefaultMavenProjectBuilder
buildArtifactRepositories( getSuperModel() ), buildArtifactRepositories( getSuperModel() ),
projectDescriptor.getAbsoluteFile().getParentFile(), profileManager ); projectDescriptor.getAbsoluteFile().getParentFile(), profileManager );
if ( project.getDistributionManagement() != null && project.getDistributionManagement().getStatus() != null ) if ( checkDistributionManagementStatus )
{ {
throw new ProjectBuildingException( project.getId(), if ( project.getDistributionManagement() != null && project.getDistributionManagement().getStatus() != null )
"Invalid project file: distribution status must not be specified for a project outside of the repository" ); {
throw new ProjectBuildingException( project.getId(),
"Invalid project file: distribution status must not be specified for a project outside of the repository" );
}
} }
// Only translate the base directory for files in the source tree // Only translate the base directory for files in the source tree