Java 类org.apache.maven.model.locator.DefaultModelLocator 实例源码

项目:migration-tooling    文件:Resolver.java   
/**
 * Given a local path to a Maven project, this attempts to find the transitive dependencies of the
 * project.
 *
 * @param projectPath The path to search for Maven projects.
 * @param scopes The scopes to look up dependencies in.
 */
public String resolvePomDependencies(String projectPath, Set<String> scopes) {
  DefaultModelProcessor processor = new DefaultModelProcessor();
  processor.setModelLocator(new DefaultModelLocator());
  processor.setModelReader(new DefaultModelReader());
  File pom = processor.locatePom(new File(projectPath));
  FileModelSource pomSource = new FileModelSource(pom);
  // First resolve the model source locations.
  resolveSourceLocations(pomSource);
  // Next, fully resolve the models.
  Model model = modelResolver.getEffectiveModel(pomSource);
  if (model != null) {
    traverseDeps(model, scopes, Sets.newHashSet(), null);
  }
  return pom.getAbsolutePath();
}
项目:spring-cloud-function    文件:DependencyResolver.java   
@Override
protected void configure() {
    bind(ModelLocator.class).to(DefaultModelLocator.class).in(Singleton.class);
    bind(ModelReader.class).to(DefaultModelReader.class).in(Singleton.class);
    bind(ModelValidator.class).to(DefaultModelValidator.class).in(Singleton.class);
    bind(RepositoryConnectorFactory.class).to(BasicRepositoryConnectorFactory.class)
            .in(Singleton.class);
    bind(ArtifactDescriptorReader.class) //
            .to(DefaultArtifactDescriptorReader.class).in(Singleton.class);
    bind(VersionResolver.class) //
            .to(DefaultVersionResolver.class).in(Singleton.class);
    bind(VersionRangeResolver.class) //
            .to(DefaultVersionRangeResolver.class).in(Singleton.class);
    bind(MetadataGeneratorFactory.class).annotatedWith(Names.named("snapshot")) //
            .to(SnapshotMetadataGeneratorFactory.class).in(Singleton.class);
    bind(MetadataGeneratorFactory.class).annotatedWith(Names.named("versions")) //
            .to(VersionsMetadataGeneratorFactory.class).in(Singleton.class);
    bind(TransporterFactory.class).annotatedWith(Names.named("http"))
            .to(HttpTransporterFactory.class).in(Singleton.class);
    bind(TransporterFactory.class).annotatedWith(Names.named("file"))
            .to(FileTransporterFactory.class).in(Singleton.class);
}
项目:mvn-fluid-cd    文件:FreezeModelLocator.java   
@Override
public File locatePom(File projectDirectory) {
    try {
        File pomFile = new DefaultModelLocator().locatePom(projectDirectory);
        if (stamper.isEnabled()) {
            logger.info("[FreezeModelLocator]: Freeze pom in folder " + projectDirectory.getAbsolutePath());
            artifactFreezeMapping.put(pomFile);
            logger.debug("[FreezeModelLocator]: Freezing pom " + pomFile.getAbsolutePath());
            return pomFreezer.freeze(pomFile);
        } else {
            return pomFile;
        }
    } catch (RuntimeException e) {
        throw new FreezeException("Unable to locate " +
                (stamper.isEnabled() ? " frozen " : "") +
                "pom in directory [" + projectDirectory + "] ...", e);
    }
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:SpringBootDependenciesDependencyManagement.java   
private static Model readModel() {
    DefaultModelProcessor modelProcessor = new DefaultModelProcessor();
    modelProcessor.setModelLocator(new DefaultModelLocator());
    modelProcessor.setModelReader(new DefaultModelReader());

    try {
        return modelProcessor.read(SpringBootDependenciesDependencyManagement.class
                .getResourceAsStream("effective-pom.xml"), null);
    }
    catch (IOException ex) {
        throw new IllegalStateException("Failed to build model from effective pom",
                ex);
    }
}
项目:spring-boot-concourse    文件:SpringBootDependenciesDependencyManagement.java   
private static Model readModel() {
    DefaultModelProcessor modelProcessor = new DefaultModelProcessor();
    modelProcessor.setModelLocator(new DefaultModelLocator());
    modelProcessor.setModelReader(new DefaultModelReader());

    try {
        return modelProcessor.read(SpringBootDependenciesDependencyManagement.class
                .getResourceAsStream("effective-pom.xml"), null);
    }
    catch (IOException ex) {
        throw new IllegalStateException("Failed to build model from effective pom",
                ex);
    }
}
项目:contestparser    文件:SpringBootDependenciesDependencyManagement.java   
private static Model readModel() {
    DefaultModelProcessor modelProcessor = new DefaultModelProcessor();
    modelProcessor.setModelLocator(new DefaultModelLocator());
    modelProcessor.setModelReader(new DefaultModelReader());

    try {
        return modelProcessor.read(SpringBootDependenciesDependencyManagement.class
                .getResourceAsStream("effective-pom.xml"), null);
    }
    catch (IOException ex) {
        throw new IllegalStateException("Failed to build model from effective pom",
                ex);
    }
}
项目:oceano    文件:DefaultModelBuilderFactory.java   
protected ModelLocator newModelLocator()
{
    return new DefaultModelLocator();
}