private ArtifactInstallerRequest processProject()

in src/main/java/org/apache/maven/plugins/install/InstallMojo.java [181:216]


    private ArtifactInstallerRequest processProject(Project project) {
        ProjectManager projectManager = getProjectManager();
        Collection<ProducedArtifact> installables = projectManager.getAllArtifacts(project);
        Collection<ProducedArtifact> attachedArtifacts = projectManager.getAttachedArtifacts(project);

        getArtifactManager().setPath(project.getPomArtifact(), project.getPomPath());

        for (Artifact installable : installables) {
            if (!isValidPath(installable)) {
                if (installable == project.getMainArtifact().orElse(null)) {
                    if (attachedArtifacts.isEmpty()) {
                        throw new MojoException(
                                "The packaging for this project did not assign a file to the build artifact");
                    } else {
                        if (allowIncompleteProjects) {
                            getLog().warn("");
                            getLog().warn("The packaging plugin for this project did not assign");
                            getLog().warn(
                                            "a main file to the project but it has attachments. Change packaging to 'pom'.");
                            getLog().warn("");
                            getLog().warn("Incomplete projects like this will fail in future Maven versions!");
                            getLog().warn("");
                        } else {
                            throw new MojoException("The packaging plugin for this project did not assign "
                                    + "a main file to the project but it has attachments. Change packaging to 'pom'.");
                        }
                    }
                } else {
                    throw new MojoException("The packaging for this project did not assign "
                            + "a file to the attached artifact: " + installable);
                }
            }
        }

        return ArtifactInstallerRequest.build(session, installables);
    }