org.apache.maven.plugin.MojoExecution.getLifecyclePhase()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(7.8k)|赞(0)|评价(0)|浏览(90)

本文整理了Java中org.apache.maven.plugin.MojoExecution.getLifecyclePhase()方法的一些代码示例,展示了MojoExecution.getLifecyclePhase()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MojoExecution.getLifecyclePhase()方法的具体详情如下:
包路径:org.apache.maven.plugin.MojoExecution
类名称:MojoExecution
方法名:getLifecyclePhase

MojoExecution.getLifecyclePhase介绍

暂无

代码示例

代码示例来源:origin: apache/maven

public String getLifecyclePhase()
{
  return mojoExecution.getLifecyclePhase();
}

代码示例来源:origin: apache/maven

public boolean isDifferentPhase( MojoExecution nextMojoExecution )
{
  String lifecyclePhase = nextMojoExecution.getLifecyclePhase();
  if ( lifecyclePhase == null )
  {
    return lastLifecyclePhase != null;
  }
  return !lifecyclePhase.equals( lastLifecyclePhase );
}

代码示例来源:origin: eirslett/frontend-maven-plugin

/**
 * Determines if the current execution is during a testing phase (e.g., "test" or "integration-test").
 */
private boolean isTestingPhase() {
  String phase = execution.getLifecyclePhase();
  return "test".equals(phase) || "integration-test".equals(phase);
}

代码示例来源:origin: apache/maven

public void observeExecution( MojoExecution mojoExecution )
{
  String lifecyclePhase = mojoExecution.getLifecyclePhase();
  if ( lifecyclePhase != null )
  {
    if ( lastLifecyclePhase == null )
    {
      lastLifecyclePhase = lifecyclePhase;
    }
    else if ( !lifecyclePhase.equals( lastLifecyclePhase ) )
    {
      project.addLifecyclePhase( lastLifecyclePhase );
      lastLifecyclePhase = lifecyclePhase;
    }
  }
  if ( lastLifecyclePhase != null )
  {
    project.addLifecyclePhase( lastLifecyclePhase );
  }
}

代码示例来源:origin: protostuff/protostuff

if (GENERATE_TEST_SOURCES_PHASE.equals(execution.getLifecyclePhase()))
  if (GENERATE_TEST_SOURCES_PHASE.equals(execution.getLifecyclePhase()))

代码示例来源:origin: com.github.eirslett/frontend-maven-plugin

/**
 * Determines if the current execution is during a testing phase (e.g., "test" or "integration-test").
 */
private boolean isTestingPhase() {
  String phase = execution.getLifecyclePhase();
  return "test".equals(phase) || "integration-test".equals(phase);
}

代码示例来源:origin: protostuff/protostuff-compiler

String computeSourceOutputDir(@Nullable File target) {
  String output;
  if (target != null) {
    output = target.getAbsolutePath();
  } else {
    String phase = execution.getLifecyclePhase();
    String buildDirectory = project.getBuild().getDirectory();
    if (GENERATE_TEST_SOURCES.id().equals(phase)) {
      output = buildDirectory + GENERATED_TEST_SOURCES;
    } else {
      output = buildDirectory + GENERATED_SOURCES;
    }
  }
  LOGGER.debug("output = {}", output);
  return output;
}

代码示例来源:origin: protostuff/protostuff-compiler

Path getSourcePath() {
  if (source != null) {
    return source.toPath();
  }
  String phase = execution.getLifecyclePhase();
  String basedir;
  basedir = getCanonicalPath(project.getBasedir());
  String sourcePath;
  if (GENERATE_TEST_SOURCES.id().equals(phase)) {
    sourcePath = basedir + "/src/test/proto/";
  } else {
    sourcePath = basedir + "/src/main/proto/";
  }
  return Paths.get(sourcePath);
}

代码示例来源:origin: reactiverse/vertx-maven-plugin

private List<Callable<Void>> computeExecutionChain() {
  List<Callable<Void>> list = new ArrayList<>();
  if (MojoSpy.MOJOS.isEmpty()) {
    getLog().info("No plugin execution collected. The vertx:initialize goal has not " +
      "been run beforehand. Only handling resources and java compilation");
    list.add(new JavaBuildCallback());
    list.add(new ResourceBuildCallback());
  } else {
    list = MojoSpy.MOJOS.stream()
      // Include only mojo in [generate-source, process-classes]
      .filter(exec -> MojoSpy.PHASES.contains(exec.getLifecyclePhase()))
      .map(this::toTask)
      .collect(Collectors.toList());
  }
  return list;
}

代码示例来源:origin: com.google.cloud.tools/jib-maven-plugin

@Override
 public void execute() throws MojoExecutionException, MojoFailureException {
  Preconditions.checkNotNull(lifecycleExecutor);
  Preconditions.checkNotNull(session);

  MavenExecutionPlan mavenExecutionPlan;
  try {
   mavenExecutionPlan = lifecycleExecutor.calculateExecutionPlan(session, "package");
  } catch (Exception ex) {
   throw new MojoExecutionException("failed to calculate execution plan", ex);
  }

  mavenExecutionPlan
    .getMojoExecutions()
    .stream()
    .filter(mojoExecution -> "package".equals(mojoExecution.getLifecyclePhase()))
    .filter(
      mojoExecution ->
        MavenProjectProperties.PLUGIN_NAME.equals(
          mojoExecution.getPlugin().getArtifactId()))
    .map(MojoExecution::getGoal)
    .forEach(System.out::println);
 }
}

代码示例来源:origin: protostuff/protostuff-compiler

void addGeneratedSourcesToProject(String output) {
  // Include generated directory to the list of compilation sources
  if (GENERATE_TEST_SOURCES.id().equals(execution.getLifecyclePhase())) {
    project.addTestCompileSourceRoot(output);
  } else {
    project.addCompileSourceRoot(output);
  }
}

代码示例来源:origin: be.fluid-it.tools.mvn.cd/mvn-ext-freeze

private String mojoExecutionFullId(ExecutionEvent event) {
  StringBuffer result = new StringBuffer("[");
  if (event.getMojoExecution() != null) {
    String phase = event.getMojoExecution().getLifecyclePhase();
    if (phase != null) {
      result.append(phase).append(":");
    }
    Plugin plugin = event.getMojoExecution().getPlugin();
    if (plugin != null) {
      result.append(plugin.getGroupId()).append(":").append(plugin.getArtifactId()).append(":").append(plugin.getVersion());
    }
    String executionId = event.getMojoExecution().getExecutionId();
    if (executionId != null) {
      result.append(":").append(executionId);
    }
    String goal = event.getMojoExecution().getGoal();
    if (executionId != null) {
      result.append(":").append(goal);
    }
  }
  result.append("]");
  return result.toString();
}

代码示例来源:origin: jmeter-maven-plugin/jmeter-maven-plugin

@Override
public final void execute() throws MojoExecutionException, MojoFailureException {
  if (skipTests) {
    if (session.getGoals().contains("jmeter:gui")) {
      if (!"default-cli".equals(mojoExecution.getExecutionId()) && 
          !"compile".equals(mojoExecution.getLifecyclePhase())) {
        getLog().info("Performance tests are skipped.");
        return;
      }
    } else {
      getLog().info("Performance tests are skipped.");
      return;
    }
  }
  // load maven proxy if needed
  if (useMavenProxy && proxyConfig == null) {
    loadMavenProxy();
  }
  doExecute();
}

代码示例来源:origin: org.hudsonci.plugins/maven3-eventspy-3.1

private void recordMojoStarted( final ExecutionEvent event )
{
  if( ExecutionEvent.Type.MojoStarted.equals(event.getType()) )
  {
    MojoExecution mojoExecution = event.getMojoExecution();
    ProjectLogger.log(event.getProject(), "mojo started - " + mojoExecution.getLifecyclePhase() + " " + mojoExecution.getArtifactId() + " " + mojoExecution.getExecutionId() );
    
    // There are none.
    //log.debug("Mojo Plugin deps: {}", mojoExecution.getPlugin().getDependencies());
  }
}

代码示例来源:origin: org.eclipse.hudson.main/maven3-eventspy-3.0

private void recordMojoStarted( final ExecutionEvent event )
{
  if( ExecutionEvent.Type.MojoStarted.equals(event.getType()) )
  {
    MojoExecution mojoExecution = event.getMojoExecution();
    ProjectLogger.log(event.getProject(), "mojo started - " + mojoExecution.getLifecyclePhase() + " " + mojoExecution.getArtifactId() + " " + mojoExecution.getExecutionId() );
    
    // There are none.
    //log.debug("Mojo Plugin deps: {}", mojoExecution.getPlugin().getDependencies());
  }
}

代码示例来源:origin: org.jvnet.hudson.main/maven3-eventspy-3.0

private void recordMojoStarted( final ExecutionEvent event )
{
  if( ExecutionEvent.Type.MojoStarted.equals(event.getType()) )
  {
    MojoExecution mojoExecution = event.getMojoExecution();
    ProjectLogger.log(event.getProject(), "mojo started - " + mojoExecution.getLifecyclePhase() + " " + mojoExecution.getArtifactId() + " " + mojoExecution.getExecutionId() );
    
    // There are none.
    //log.debug("Mojo Plugin deps: {}", mojoExecution.getPlugin().getDependencies());
  }
}

代码示例来源:origin: jenkinsci/pipeline-maven-plugin

if (execution.getLifecyclePhase() != null) {
  plugin.setAttribute("lifecyclePhase", execution.getLifecyclePhase());

代码示例来源:origin: takari/maven-profiler

sessionProfile.addProjectProfile(projectProfile);
} else if (executionEvent.getType() == ExecutionEvent.Type.MojoStarted) {
 String phase = executionEvent.getMojoExecution().getLifecyclePhase();

相关文章