// Path: src/main/java/com/github/alexcojocaru/mojo/elasticsearch/v2/configuration/ArtifactException.java
// public class ArtifactException extends Exception {
// 
//     private static final long serialVersionUID = -3217334010123902842L;
// 
//     public ArtifactException(String message, Throwable cause) {
//         super(message, cause);
//     }
// 
//     public ArtifactException(Throwable cause) {
//         super(cause);
//     }
// 
//     public ArtifactException(String message) {
//         super(message);
//     }
// 
// }
// 
// Path: src/main/java/com/github/alexcojocaru/mojo/elasticsearch/v2/configuration/PluginArtifactInstaller.java
// public interface PluginArtifactInstaller
// {
// 
//     void installArtifact(ElasticsearchArtifact artifact, File file) throws ArtifactException;
// 
// }


import java.io.File;
import org.apache.maven.plugin.logging.Log;
import org.eclipse.aether.RepositorySystem;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.artifact.Artifact;
import org.eclipse.aether.artifact.DefaultArtifact;
import org.eclipse.aether.installation.InstallRequest;
import org.eclipse.aether.installation.InstallationException;
import com.github.alexcojocaru.mojo.elasticsearch.v2.configuration.ArtifactException;
import com.github.alexcojocaru.mojo.elasticsearch.v2.configuration.PluginArtifactInstaller;
            Log log)
    {
        this.repositorySystem = repositorySystem;
        this.repositorySession = repositorySession;
        this.log = log;
    }

    @Override
    public void installArtifact(ElasticsearchArtifact artifact, File file) throws ArtifactException
    {
        log.debug("Installing '" + file.getAbsolutePath() + "' in the local maven repo");

        InstallRequest request = new InstallRequest();
        Artifact defaultArtifact = new DefaultArtifact(
                artifact.getGroupId(),
                artifact.getArtifactId(),
                artifact.getClassifier(),
                artifact.getType(),
                artifact.getVersion(),
                null,
                file);
        request.addArtifact(defaultArtifact);

        log.info(String.format("Installing maven artifact: %s", artifact));

        try
        {
            repositorySystem.install(repositorySession, request);
        }
        catch (InstallationException e) {
// Path: src/main/java/com/github/alexcojocaru/mojo/elasticsearch/v2/configuration/ArtifactException.java
// public class ArtifactException extends Exception {
// 
//     private static final long serialVersionUID = -3217334010123902842L;
// 
//     public ArtifactException(String message, Throwable cause) {
//         super(message, cause);
//     }
// 
//     public ArtifactException(Throwable cause) {
//         super(cause);
//     }
// 
//     public ArtifactException(String message) {
//         super(message);
//     }
// 
// }
// 
// Path: src/main/java/com/github/alexcojocaru/mojo/elasticsearch/v2/configuration/PluginArtifactInstaller.java
// public interface PluginArtifactInstaller
// {
// 
//     void installArtifact(ElasticsearchArtifact artifact, File file) throws ArtifactException;
// 
// }


// Path: src/main/java/com/github/alexcojocaru/mojo/elasticsearch/v2/MyArtifactInstaller.java
import java.io.File;
import org.apache.maven.plugin.logging.Log;
import org.eclipse.aether.RepositorySystem;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.artifact.Artifact;
import org.eclipse.aether.artifact.DefaultArtifact;
import org.eclipse.aether.installation.InstallRequest;
import org.eclipse.aether.installation.InstallationException;
import com.github.alexcojocaru.mojo.elasticsearch.v2.configuration.ArtifactException;
import com.github.alexcojocaru.mojo.elasticsearch.v2.configuration.PluginArtifactInstaller;

            Log log)
    {
        this.repositorySystem = repositorySystem;
        this.repositorySession = repositorySession;
        this.log = log;
    }

    @Override
    public void installArtifact(ElasticsearchArtifact artifact, File file) throws ArtifactException
    {
        log.debug("Installing '" + file.getAbsolutePath() + "' in the local maven repo");

        InstallRequest request = new InstallRequest();
        Artifact defaultArtifact = new DefaultArtifact(
                artifact.getGroupId(),
                artifact.getArtifactId(),
                artifact.getClassifier(),
                artifact.getType(),
                artifact.getVersion(),
                null,
                file);
        request.addArtifact(defaultArtifact);

        log.info(String.format("Installing maven artifact: %s", artifact));

        try
        {
            repositorySystem.install(repositorySession, request);
        }
        catch (InstallationException e) {
            throw new ArtifactException(e.getMessage(), e);