use of org.apache.maven.model.locator.DefaultModelLocator 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("effective-pom.xml"), null);
} catch (IOException ex) {
throw new IllegalStateException("Failed to build model from effective pom", ex);
}
}
use of org.apache.maven.model.locator.DefaultModelLocator 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();
}
Aggregations