<commit_before>package io.takari.maven.plugins;

import io.takari.maven.plugins.util.AetherUtils;

import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.project.MavenProject;
import org.eclipse.aether.artifact.Artifact;
import org.eclipse.aether.installation.InstallRequest;
import org.eclipse.aether.installation.InstallationException;
import org.eclipse.aether.util.artifact.SubArtifact;

/**
 * @author <NAME>
 */
@Mojo(name = "install", defaultPhase = LifecyclePhase.INSTALL)
public class Install extends TakariLifecycleMojo {

  @Override
  public void executeMojo() throws MojoExecutionException {

    MavenProject lastProject = reactorProjects.get(reactorProjects.size() - 1);
    if (lastProject.equals(project)) {
      for (MavenProject reactorProject : reactorProjects) {
        installProject(reactorProject);
      }
    } else {
      getLog().info(
          "Installing " + project.getGroupId() + ":" + project.getArtifactId() + ":"
              + project.getVersion() + " at end");
    }
  }

  private void installProject(MavenProject project) throws MojoExecutionException {

    InstallRequest installRequest = new InstallRequest();

    //
    // Primary artifact
    //
    Artifact artifact = AetherUtils.toArtifact(project.getArtifact());
    installRequest.addArtifact(artifact);

    //
    // POM
    //
    Artifact pomArtifact = new SubArtifact(artifact, "", "pom");
    pomArtifact = pomArtifact.setFile(project.getFile());
    installRequest.addArtifact(pomArtifact);

    //
    // Attached artifacts
    //
    for (org.apache.maven.artifact.Artifact attachedArtifact : project.getAttachedArtifacts()) {
      installRequest.addArtifact(AetherUtils.toArtifact(attachedArtifact));
    }

    try {
      repositorySystem.install(repositorySystemSession, installRequest);
    } catch (InstallationException e) {
      throw new MojoExecutionException(e.getMessage(), e);<commit_msg>don't delay install until the end of reactor build<commit_after>package io.takari.maven.plugins;

import io.takari.maven.plugins.util.AetherUtils;

import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.project.MavenProject;
import org.eclipse.aether.artifact.Artifact;
import org.eclipse.aether.installation.InstallRequest;
import org.eclipse.aether.installation.InstallationException;
import org.eclipse.aether.util.artifact.SubArtifact;

/**
 * @author <NAME>
 */
@Mojo(name = "install", defaultPhase = LifecyclePhase.INSTALL)
public class Install extends TakariLifecycleMojo {

  @Override
  public void executeMojo() throws MojoExecutionException {
    installProject(project);
  }

  private void installProject(MavenProject project) throws MojoExecutionException {

    InstallRequest installRequest = new InstallRequest();

    //
    // Primary artifact
    //
    Artifact artifact = AetherUtils.toArtifact(project.getArtifact());
    installRequest.addArtifact(artifact);

    //
    // POM
    //
    Artifact pomArtifact = new SubArtifact(artifact, "", "pom");
    pomArtifact = pomArtifact.setFile(project.getFile());
    installRequest.addArtifact(pomArtifact);

    //
    // Attached artifacts
    //
    for (org.apache.maven.artifact.Artifact attachedArtifact : project.getAttachedArtifacts()) {
      installRequest.addArtifact(AetherUtils.toArtifact(attachedArtifact));
    }

    try {
      repositorySystem.install(repositorySystemSession, installRequest);
    } catch (InstallationException e) {
      throw new MojoExecutionException(e.getMessage(), e);
{'fraction_non_alphanumeric': 0.109192348565356, 'fraction_numerical': 0.00026567481402763017, 'mean_word_length': 4.178817056396149, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4156243', 'n_tokens_mistral': 1124, 'n_tokens_neox': 1072, 'n_words': 185}