public Model loadPomFromFile(File pomFile, String... profiles)
{
RepositorySystem system = mavenContainer.getRepositorySystem();
Settings settings = mavenContainer.getSettings();
DefaultRepositorySystemSession session = mavenContainer.setupRepoSession(system, settings);
final DefaultModelBuildingRequest request = new DefaultModelBuildingRequest()
.setSystemProperties(System.getProperties())
.setPomFile(pomFile)
.setActiveProfileIds(settings.getActiveProfiles());
ModelBuilder builder = new DefaultModelBuilderFactory().newInstance();
ModelBuildingResult result;
try
{
request.setModelResolver(new MavenModelResolver(system, session, mavenContainer
.getEnabledRepositoriesFromProfile(settings)));
result = builder.build(request);
}
// wrap exception message
catch (ModelBuildingException e)
{
String pomPath = request.getPomFile().getAbsolutePath();
StringBuilder sb = new StringBuilder("Found ").append(e.getProblems().size())
.append(" problems while building POM model from ").append(pomPath).append("\n");
int counter = 1;
for (ModelProblem problem : e.getProblems())