public interface IMavenExecutionContext
getExecutionRequest()
can be used to customize maven execution configuration parameters. Context enters execution state during #execute(..., IProgressMonitor)
invocation. During transition from configuration state to execution state, maven
session is created and the the context is associated with the current thread. Maven session instance and related
objects can be accessed through their corresponding context getXXX methods.
Maven execution contexts can be nested, i.e. new context can be created and entered from a thread that already has
associated maven execution context. By default nested contexts inherit all configuration from immediate outer
context, but can be customised via getExecutionRequest()
. Outer context is suspended during execution of
nested context's execute(ICallable, IProgressMonitor)
method.
Typical usage
IMavenExecutionContext context = maven.createExecutionContext(); MavenProject project = context.execute(new ICallable<MavenProject>() { public MavenProject call(IMavenExecutionContext context, IProgressMonitor monitor) { return maven.readMavenProject(pom, monitor); } }, monitor);
Maven execution context instances are not thread safe and cannot be used on other threads.
Modifier and Type | Method and Description |
---|---|
<V> V |
execute(ICallable<V> callable,
org.eclipse.core.runtime.IProgressMonitor monitor) |
<V> V |
execute(org.apache.maven.project.MavenProject project,
ICallable<V> callable,
org.eclipse.core.runtime.IProgressMonitor monitor) |
org.apache.maven.execution.MavenExecutionRequest |
getExecutionRequest()
Can be called outside of
execute(ICallable, IProgressMonitor) to configure Maven session parameters. |
org.apache.maven.artifact.repository.ArtifactRepository |
getLocalRepository() |
org.eclipse.aether.RepositorySystemSession |
getRepositorySession() |
org.apache.maven.execution.MavenSession |
getSession() |
org.apache.maven.project.ProjectBuildingRequest |
newProjectBuildingRequest() |
org.apache.maven.execution.MavenExecutionRequest getExecutionRequest() throws org.eclipse.core.runtime.CoreException
execute(ICallable, IProgressMonitor)
to configure Maven session parameters. For
nested contexts, invocation of this method triggers creation of new nested session. When called during
execute(MavenProject, ICallable, IProgressMonitor)
, only getter request methods are allowed and all
request setter or modifier will through IllegalStateException
.org.eclipse.core.runtime.CoreException
<V> V execute(ICallable<V> callable, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
org.eclipse.core.runtime.CoreException
<V> V execute(org.apache.maven.project.MavenProject project, ICallable<V> callable, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
org.eclipse.core.runtime.CoreException
org.apache.maven.execution.MavenSession getSession()
IllegalStateException
- if called outside of execute(MavenProject,ICallable, IProgressMonitor)
org.apache.maven.artifact.repository.ArtifactRepository getLocalRepository()
IllegalStateException
- if called outside of execute(MavenProject,ICallable, IProgressMonitor)
org.eclipse.aether.RepositorySystemSession getRepositorySession()
IllegalStateException
- if called outside of execute(MavenProject, ICallable, IProgressMonitor)
org.apache.maven.project.ProjectBuildingRequest newProjectBuildingRequest()
Copyright © 2005–2015 Sonatype, Inc.. All rights reserved.