private void configureResolver( ModelResolver modelResolver, Model model, DefaultModelProblemCollector problems ) { if ( modelResolver == null ) { return; } problems.setSource( model ); List<Repository> repositories = model.getRepositories(); for ( Repository repository : repositories ) { try { modelResolver.addRepository( repository ); } catch ( InvalidRepositoryException e ) { problems.add( new ModelProblemCollectorRequest(Severity.ERROR, Version.BASE) .setMessage( "Invalid repository " + repository.getId() + ": " + e.getMessage()) .setLocation(repository.getLocation( "" )) .setException(e) ); } } }
@Override public ModelResolver newCopy() { return new NBRepositoryModelResolver(this); }
@Override public ModelResolver newCopy() { return new DefaultModelResolver(aether, repositories, ruleNameToModelSource, modelBuilder); }
@Override public ModelResolver newCopy() { return new SimpleModelResolver(this); }
@Override public ModelResolver newCopy() { return new RepositoryModelResolver( managedRepository, pathTranslator, wagonFactory, remoteRepositories, networkProxyMap, targetRepository ); }
@Override public ModelResolver newCopy() { return this; }
/** * {@inheritDoc} */ public ModelResolver newCopy() { return new FlattenModelResolver( this ); }
@Override public ModelResolver newCopy() { return new MavenModelResolver(this); }
public ModelResolver newCopy() { return new DefaultModelResolver( this ); }
public ModelResolver newCopy() { return new ProjectModelResolver( this ); }
public ModelResolver getModelResolver() { return this.modelResolver; }
public DefaultModelBuildingRequest setModelResolver( ModelResolver modelResolver ) { this.modelResolver = modelResolver; return this; }
private ModelData readParentExternally( Model childModel, ModelBuildingRequest request, DefaultModelProblemCollector problems ) throws ModelBuildingException { problems.setSource( childModel ); Parent parent = childModel.getParent(); String groupId = parent.getGroupId(); String artifactId = parent.getArtifactId(); String version = parent.getVersion(); ModelResolver modelResolver = request.getModelResolver(); if ( modelResolver == null ) { throw new IllegalArgumentException( "no model resolver provided, cannot resolve parent POM " + ModelProblemUtils.toId( groupId, artifactId, version ) + " for POM " + ModelProblemUtils.toSourceHint( childModel ) ); } ModelSource modelSource; try { modelSource = modelResolver.resolveModel( groupId, artifactId, version ); } catch ( UnresolvableModelException e ) { StringBuilder buffer = new StringBuilder( 256 ); buffer.append( "Non-resolvable parent POM" ); if ( !containsCoordinates( e.getMessage(), groupId, artifactId, version ) ) { buffer.append( " " ).append( ModelProblemUtils.toId( groupId, artifactId, version ) ); } if ( childModel != problems.getRootModel() ) { buffer.append( " for " ).append( ModelProblemUtils.toId( childModel ) ); } buffer.append( ": " ).append( e.getMessage() ); if ( childModel.getProjectDirectory() != null ) { if ( parent.getRelativePath() == null || parent.getRelativePath().length() <= 0 ) { buffer.append( " and 'parent.relativePath' points at no local POM" ); } else { buffer.append( " and 'parent.relativePath' points at wrong local POM" ); } } problems.add( new ModelProblemCollectorRequest(Severity.FATAL, Version.BASE) .setMessage( buffer.toString()) .setLocation(parent.getLocation( "" )) .setException(e)); throw problems.newModelBuildingException(); } ModelBuildingRequest lenientRequest = request; if ( request.getValidationLevel() > ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_2_0 ) { lenientRequest = new FilterModelBuildingRequest( request ) { @Override public int getValidationLevel() { return ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_2_0; } }; } Model parentModel = readModel( modelSource, null, lenientRequest, problems ); ModelData parentData = new ModelData( parentModel, groupId, artifactId, version ); return parentData; }
public ModelResolver getModelResolver() { return request.getModelResolver(); }
public FilterModelBuildingRequest setModelResolver( ModelResolver modelResolver ) { request.setModelResolver( modelResolver ); return this; }
/** * Gets the model resolver to use for resolution of mixins or parents that are not locally reachable from the * project directory. * * @return The model resolver or {@code null} if not set. */ ModelResolver getModelResolver();
/** * Sets the model resolver to use for resolution of mixins or parents that are not locally reachable from the * project directory. * * @param modelResolver The model resolver to use, may be {@code null}. * @return This request, never {@code null}. */ ModelBuildingRequest setModelResolver( ModelResolver modelResolver );