org.apache.maven.execution.ExecutionListener Java Examples

The following examples show how to use org.apache.maven.execution.ExecutionListener. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MutableMojo.java    From java-specialagent with Apache License 2.0 6 votes vote down vote up
static void resolveDependencies(final MavenSession session, final MojoExecution execution, final MojoExecutor executor, final ProjectDependenciesResolver projectDependenciesResolver) throws DependencyResolutionException, LifecycleExecutionException {
//    flushProjectArtifactsCache(executor);

    final MavenProject project = session.getCurrentProject();
    final Set<Artifact> dependencyArtifacts = project.getDependencyArtifacts();
    final Map<String,List<MojoExecution>> executions = new LinkedHashMap<>(execution.getForkedExecutions());
    final ExecutionListener executionListener = session.getRequest().getExecutionListener();
    try {
      project.setDependencyArtifacts(null);
      execution.getForkedExecutions().clear();
      session.getRequest().setExecutionListener(null);
      executor.execute(session, Collections.singletonList(execution), new ProjectIndex(session.getProjects()));
    }
    finally {
      execution.getForkedExecutions().putAll(executions);
      session.getRequest().setExecutionListener(executionListener);
      project.setDependencyArtifacts(dependencyArtifacts);
    }

    projectDependenciesResolver.resolve(newDefaultDependencyResolutionRequest(session));
  }
 
Example #2
Source File: MavenProjectConfigCollector.java    From helidon-build-tools with Apache License 2.0 4 votes vote down vote up
private EventListener(ExecutionListener next) {
    this.next = next == null ? new AbstractExecutionListener() {
    } : next;
}