//package org.suriya.mojo;
//
//import com.fasterxml.jackson.databind.ObjectMapper;
//import com.fasterxml.jackson.databind.SerializationFeature;
//import org.apache.maven.artifact.Artifact;
//import org.apache.maven.artifact.DependencyResolutionRequiredException;
//import org.apache.maven.plugin.AbstractMojo;
//import org.apache.maven.plugin.MojoExecutionException;
//import org.apache.maven.plugins.annotations.LifecyclePhase;
//import org.apache.maven.plugins.annotations.Mojo;
//import org.apache.maven.plugins.annotations.Parameter;
//import org.apache.maven.plugins.annotations.ResolutionScope;
//import org.apache.maven.project.MavenProject;
//import data.com.suriyaprakhash.Dependency;
//
//import java.io.IOException;
//import java.util.List;
//import java.util.Set;
//import java.util.stream.Collectors;
//
//@Mojo(name = "json-tree-export",
//        defaultPhase = LifecyclePhase.INITIALIZE,
//        requiresDependencyCollection = ResolutionScope.COMPILE_PLUS_RUNTIME,
//        requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME)
//public class JsonTreeExportMojo extends AbstractMojo {
//
//    @Parameter(defaultValue = "${project}", required = true, readonly = true)
//    MavenProject mavenProject;
//
//    public void execute() throws MojoExecutionException
//    {
//        getLog().info( "The following artifacts are part of the either compile time or " +
//                "runtime dependency:");
//        ObjectMapper objectMapper = new ObjectMapper();
//        objectMapper.enable(SerializationFeature.INDENT_OUTPUT);
//
//
//        try {
//            getLog().info("runtime classpath : " + mavenProject.getRuntimeClasspathElements());
//            List<Artifact> artifacts = mavenProject.getRuntimeClasspathElements();
//            List<Dependency> dependencies = artifacts.stream().map(streamedArtifact -> {
//                Artifact artifact = ((Artifact)streamedArtifact);
//                Dependency dependency = new Dependency();
//                dependency.groupId = artifact.getGroupId();
//                dependency.artifactId = artifact.getArtifactId();
//                dependency.version = artifact.getVersion();
//                return dependency;
//            }).collect(Collectors.toList());
//            getLog().info("dependencies json : " + objectMapper.writeValueAsString(dependencies));
//        } catch (IOException e) {
//            throw new RuntimeException(e);
//        } catch (DependencyResolutionRequiredException e) {
//            throw new RuntimeException(e);
//        }
//    }
//
//}