Example usage for org.apache.maven.project ProjectBuildingResult getPomFile

List of usage examples for org.apache.maven.project ProjectBuildingResult getPomFile

Introduction

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

Prototype

File getPomFile();

Source Link

Document

Gets the POM file from which the project was built.

Usage

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);
        }/*from  w  w  w.j  av  a  2s. co 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;
            }
        }

    }
}