public MavenProject buildFromRepository( Artifact artifact, List remoteArtifactRepositories, ArtifactRepository localRepository, boolean allowStubModel ) throws ProjectBuildingException { String cacheKey = createCacheKey( artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion() ); MavenProject project = (MavenProject) processedProjectCache.get( cacheKey ); if ( project != null ) { return project; } Model model = findModelFromRepository( artifact, remoteArtifactRepositories, localRepository, allowStubModel ); ProjectBuilderConfiguration config = new DefaultProjectBuilderConfiguration().setLocalRepository( localRepository ); return buildInternal( "Artifact [" + artifact + "]", model, config, remoteArtifactRepositories, null, false ); }
private MavenProject buildFromSourceFileInternal( File projectDescriptor, ProjectBuilderConfiguration config, boolean checkDistributionManagementStatus ) throws ProjectBuildingException { Model model = readModel( "unknown", projectDescriptor, true ); MavenProject project = buildInternal( projectDescriptor.getAbsolutePath(), model, config, buildArtifactRepositories( getSuperModel() ), projectDescriptor, true ); if ( checkDistributionManagementStatus ) { if ( ( project.getDistributionManagement() != null ) && ( project.getDistributionManagement().getStatus() != null ) ) { String projectId = safeVersionlessKey( project.getGroupId(), project.getArtifactId() ); throw new ProjectBuildingException( projectId, "Invalid project file: distribution status must not be specified for a project outside of the repository" ); } } return project; }