public String getLifecyclePhase() { return mojoExecution.getLifecyclePhase(); }
public boolean isDifferentPhase( MojoExecution nextMojoExecution ) { String lifecyclePhase = nextMojoExecution.getLifecyclePhase(); if ( lifecyclePhase == null ) { return lastLifecyclePhase != null; } return !lifecyclePhase.equals( lastLifecyclePhase ); }
/** * 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); }
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 ); } }
if (GENERATE_TEST_SOURCES_PHASE.equals(execution.getLifecyclePhase())) if (GENERATE_TEST_SOURCES_PHASE.equals(execution.getLifecyclePhase()))
/** * 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); }
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; }
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); }
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; }
@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); } }
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); } }
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(); }
@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(); }
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()); } }
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()); } }
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()); } }
if (execution.getLifecyclePhase() != null) { plugin.setAttribute("lifecyclePhase", execution.getLifecyclePhase());
sessionProfile.addProjectProfile(projectProfile); } else if (executionEvent.getType() == ExecutionEvent.Type.MojoStarted) { String phase = executionEvent.getMojoExecution().getLifecyclePhase();