All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.sitoolkit.wt.plugin.maven.ReportOpenMojo Maven / Gradle / Ivy

package io.sitoolkit.wt.plugin.maven;

import org.apache.commons.lang3.StringUtils;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import io.sitoolkit.wt.domain.evidence.EvidenceDir;
import io.sitoolkit.wt.domain.evidence.ReportOpener;

@Mojo(name = "open-report", defaultPhase = LifecyclePhase.VERIFY)
public class ReportOpenMojo extends AbstractMojo {

  @Parameter(property = "evidence.open", defaultValue = "true")
  private String evidenceOpen;

  @Parameter(property = "evidence.target")
  private String targetEvidence;

  @Override
  public void execute() throws MojoExecutionException, MojoFailureException {
    if (Boolean.parseBoolean(evidenceOpen)) {

      EvidenceDir evidenceDir;
      if (StringUtils.isEmpty(targetEvidence)) {
        evidenceDir = EvidenceDir.getLatest();
      } else {
        evidenceDir = EvidenceDir.targetEvidenceDir(targetEvidence);
      }

      ReportOpener opener = new ReportOpener();
      opener.open(evidenceDir);
    }
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy