use of org.apache.maven.model.io.DefaultModelReader in project bazel by bazelbuild.
the class Resolver method resolvePomDependencies.
/**
* 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.
*/
public String resolvePomDependencies(String projectPath) {
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.
resolveEffectiveModel(pomSource, Sets.<String>newHashSet(), null);
return pom.getAbsolutePath();
}
use of org.apache.maven.model.io.DefaultModelReader in project spring-boot by spring-projects.
the class SpringBootDependenciesDependencyManagement method readModel.
private static Model readModel() {
DefaultModelProcessor modelProcessor = new DefaultModelProcessor();
modelProcessor.setModelLocator(new DefaultModelLocator());
modelProcessor.setModelReader(new DefaultModelReader());
try {
return modelProcessor.read(SpringBootDependenciesDependencyManagement.class.getResourceAsStream("spring-boot-dependencies-effective-bom.xml"), null);
} catch (IOException ex) {
throw new IllegalStateException("Failed to build model from effective pom", ex);
}
}
Aggregations