private void ensureMetadataSourceIsInitialized() throws ProjectBuildingException { if ( artifactMetadataSource == null ) { try { artifactMetadataSource = (ArtifactMetadataSource) container.lookup( ArtifactMetadataSource.ROLE ); } catch ( ComponentLookupException e ) { throw new ProjectBuildingException( "all", "Cannot lookup metadata source for building the project.", e ); } } }
private Model readModel( String projectId, File file, boolean strict ) throws ProjectBuildingException { Reader reader = null; try { reader = ReaderFactory.newXmlReader( file ); return readModel( projectId, file.getAbsolutePath(), reader, strict ); } catch ( FileNotFoundException e ) { throw new ProjectBuildingException( projectId, "Could not find the model file '" + file.getAbsolutePath() + "'.", e ); } catch ( IOException e ) { throw new ProjectBuildingException( projectId, "Failed to build model from file '" + file.getAbsolutePath() + "'.\nError: \'" + e.getLocalizedMessage() + "\'", e ); } finally { IOUtil.close( reader ); } }
private Model readModel( String projectId, URL url, boolean strict ) throws ProjectBuildingException { Reader reader = null; try { reader = ReaderFactory.newXmlReader( url.openStream() ); return readModel( projectId, url.toExternalForm(), reader, strict ); } catch ( IOException e ) { throw new ProjectBuildingException( projectId, "Failed build model from URL \'" + url.toExternalForm() + "\'\nError: \'" + e.getLocalizedMessage() + "\'", e ); } finally { IOUtil.close( reader ); } }
throw new ProjectBuildingException( projectId, "Error building artifact repository for id: " + repo.getId(), e ); throw new ProjectBuildingException( projectId, "Error building artifact repository from non-repository information item: " + item );
throw new ProjectBuildingException( results );
throw new ProjectBuildingException( "", "Invalid remote repository " + repository, e );
private List injectActiveProfiles( ProfileManager profileManager, Model model ) throws ProjectBuildingException { List activeProfiles; if ( profileManager != null ) { try { activeProfiles = profileManager.getActiveProfiles(); } catch ( ProfileActivationException e ) { String projectId = safeVersionlessKey( model.getGroupId(), model.getArtifactId() ); throw new ProjectBuildingException( projectId, e.getMessage(), e ); } for ( Iterator it = activeProfiles.iterator(); it.hasNext(); ) { Profile profile = (Profile) it.next(); profileInjector.inject( profile, model ); } } else { activeProfiles = Collections.EMPTY_LIST; } return activeProfiles; }
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; }
throw new ProjectBuildingException( projectId, "Unable to parse version '" + version + "' for plugin '" + ArtifactUtils.versionlessKey( p.getGroupId(), p.getArtifactId() ) + "': " + e.getMessage(), e );
throw new ProjectBuildingException( projectId, "Unable to parse version '" + version + "' for extension '" + ArtifactUtils.versionlessKey( ext.getGroupId(), ext.getArtifactId() ) + "': " + e.getMessage(), e );
throw new ProjectBuildingException( projectId, "Unable to parse version '" + version + "' for report '" + ArtifactUtils.versionlessKey( p.getGroupId(), p.getArtifactId() ) + "': " + e.getMessage(), e );
private List buildArtifactRepositories( Model model ) throws ProjectBuildingException { try { return ProjectUtils.buildArtifactRepositories( model.getRepositories(), artifactRepositoryFactory, container ); } catch ( InvalidRepositoryException e ) { String projectId = safeVersionlessKey( model.getGroupId(), model.getArtifactId() ); throw new ProjectBuildingException( projectId, e.getMessage(), e ); } }
throw new ProjectBuildingException( projectId, "Error getting POM for '" + projectId + "' from the repository: " + e.getMessage(), e ); throw new ProjectBuildingException( projectId, "POM '" + projectId + "' not found in repository: " + e.getMessage(), e );
throw new ProjectBuildingException( projectId, "Unable to parse version '" + d.getVersion() + "' for dependency '" + d.getManagementKey() + "': " + e.getMessage(), e );
throw new ProjectBuildingException( projectId, "Failed to calculate active external profiles.", e ); throw new ProjectBuildingException( projectId, e.getMessage(), e ); throw new ProjectBuildingException( projectId, e.getMessage(), e );
if ( result == null || result.getEffectiveModel() == null ) throw new ProjectBuildingException( e.getModelId(), e.getMessage(), pomFile, e ); ProjectBuildingException e = new ProjectBuildingException( Arrays.asList( result ) ); e.initCause( error ); throw e;
throw new ProjectBuildingException( projectId, "Unable to build project due to an invalid dependency version: " + e.getMessage(), e );
throw new ProjectBuildingException( projectId, "Failed to activate local (project-level) build profiles: " + e.getMessage(), e ); throw new ProjectBuildingException( projectId, "Missing groupId element from parent element" ); throw new ProjectBuildingException( projectId, "Missing artifactId element from parent element" ); throw new ProjectBuildingException( projectId, "Parent element is a duplicate of " + "the current project " ); throw new ProjectBuildingException( projectId, "Missing version element from parent element" ); throw new ProjectBuildingException( project.getId(), "Cannot find parent: " + e.getProjectId() + " for project: " + project.getId(), e ); throw new ProjectBuildingException( projectId, "Parent: " + model.getId() + " of project: " + projectId + " has wrong packaging: " + model.getPackaging() + ". Must be 'pom'." );
throw new ProjectBuildingException( projectId, e.getMessage(), e ); throw new ProjectBuildingException( projectId, e.getMessage(), e );
throw new ProjectBuildingException( artifact.getId(), "Error resolving project artifact: " + e.getMessage(), e );