Example usage for org.apache.maven.project ProjectBuildingException ProjectBuildingException

List of usage examples for org.apache.maven.project ProjectBuildingException ProjectBuildingException

Introduction

In this page you can find the example usage for org.apache.maven.project ProjectBuildingException ProjectBuildingException.

Prototype

public ProjectBuildingException(List<ProjectBuildingResult> results) 

Source Link

Usage

From source file:org.echocat.jomon.maven.MavenProjectWithModulesFactory.java

License:Mozilla Public License

@Nonnull
protected MavenProjectWithModules resultsToProject(@Nonnull File basePomFile,
        @Nonnull List<ProjectBuildingResult> results) throws Exception {
    final Map<MavenProject, MavenProjectWithModules> projectToProjectWithModules = new HashMap<>();
    for (final ProjectBuildingResult result : results) {
        if (!result.getProblems().isEmpty()) {
            throw new ProjectBuildingException(results);
        }//w w  w.j a  v  a  2s. c  o m
        final MavenProjectWithModules projectWithModules = getMavenProjectWithModules(result,
                projectToProjectWithModules);
        resolveModulesFor(projectWithModules, result, results, projectToProjectWithModules);
    }
    return selectBaseProject(basePomFile.getCanonicalFile(), projectToProjectWithModules);
}

From source file:org.echocat.jomon.maven.MavenProjectWithModulesFactory.java

License:Mozilla Public License

@Nonnull
protected void resolveModulesFor(@Nonnull MavenProjectWithModules of, @Nonnull ProjectBuildingResult forResult,
        @Nonnull List<ProjectBuildingResult> fromResults,
        @Nonnull Map<MavenProject, MavenProjectWithModules> withProjectToProjectWithModules) throws Exception {
    for (final ProjectBuildingResult result : fromResults) {
        if (!result.getProblems().isEmpty()) {
            throw new ProjectBuildingException(fromResults);
        }//  w ww.ja  v  a 2s. c o  m
        for (final String moduleName : forResult.getProject().getModules()) {
            final File pomFile = result.getPomFile();
            final File expectedFile = new File(forResult.getPomFile().getParentFile(),
                    moduleName + File.separator + pomFile.getName());
            if (expectedFile.getCanonicalFile().equals(pomFile.getCanonicalFile())) {
                of.addModule(getMavenProjectWithModules(result, withProjectToProjectWithModules));
                break;
            }
        }

    }
}