io.github.uniclog.InsertJsonMojo Maven / Gradle / Ivy
package io.github.uniclog;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
import com.jayway.jsonpath.DocumentContext;
import com.jayway.jsonpath.JsonPath;
import io.github.uniclog.execution.ExecutionMojo;
import io.github.uniclog.execution.ExecutionType;
import io.github.uniclog.utils.ExecuteConsumer;
import io.github.uniclog.utils.UtilsInterface;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.logging.Log;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import java.util.List;
import static io.github.uniclog.execution.DocumentType.JSON;
import static io.github.uniclog.utils.DataUtils.getElement;
import static java.util.Objects.isNull;
import static java.util.Objects.nonNull;
@Mojo(name = "insert", defaultPhase = LifecyclePhase.PREPARE_PACKAGE)
public class InsertJsonMojo extends AbstractMojo implements UtilsInterface {
@Parameter(alias = "json.in")
private String jsonInputPath;
@Parameter(alias = "json.out")
private String jsonOutputPath;
@Parameter(alias = "executions", required = true)
private List executions;
@Override
public void execute() throws MojoExecutionException {
ExecuteConsumer