Java 类org.apache.maven.model.io.DefaultModelReader 实例源码

项目: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);
}
项目: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);
    }
}
项目:release-maven-plugin-parent    文件:BaseVersionTransferWriterTest.java   
@Before
public void setup() throws Exception {
    try (final InputStream in = getClass().getResourceAsStream("/version-transfer/" + getFileName())) {
        copyInputStreamToFile(in, originalPom);
    }

    originalPom.deleteOnExit();
    originalLines = readLines(originalPom);

    final DefaultModelReader reader = new DefaultModelReader();
    updatedModel = reader.read(originalPom, Collections.<String, Object> emptyMap());

    updatedModel.getParent().setVersion(EXPECTED_VERSIONS[0]);
    updatedModel.setVersion(EXPECTED_VERSIONS[1]);
    updatedModel.getDependencyManagement().getDependencies().get(0).setVersion(EXPECTED_VERSIONS[2]);
    updatedModel.getDependencyManagement().getDependencies().get(1).setVersion(EXPECTED_VERSIONS[3]);
    updatedModel.getDependencies().get(0).setVersion(EXPECTED_VERSIONS[4]);
    updatedModel.getDependencies().get(1).setVersion(EXPECTED_VERSIONS[5]);
    updatedModel.getDependencies().get(2).setVersion(EXPECTED_VERSIONS[6]);

    writer = new VersionTransferWriter(originalPom, getOwnVersionOrNull());
    try {
        mavenXpp3Writer.write(writer, updatedModel);
    } finally {
        writer.close();
    }

    updatedLines = readLines(originalPom);
}
项目:eclipselink-example    文件:POM.java   
private static Model getModel() {
    ModelReader modelReader = new DefaultModelReader();
    try {
        return modelReader.read(new File("pom.xml"), null);
    } catch (IOException cause) {
        throw new RuntimeException(cause);
    }
}
项目:eclipselink-example    文件:POM.java   
private static Model getModel() {
    ModelReader modelReader = new DefaultModelReader();
    try {
        return modelReader.read(new File("pom.xml"), null);
    } catch (IOException cause) {
        throw new RuntimeException(cause);
    }
}
项目: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);
    }
}
项目:neoscada    文件:ChangeManager.java   
public ChangeManager ( final Log log )
{
    this.log = log;
    this.writer = new DefaultModelWriter ();
    this.reader = new DefaultModelReader ();
}
项目:oceano    文件:DefaultModelBuilderFactory.java   
protected ModelReader newModelReader()
{
    return new DefaultModelReader();
}