public class MavenProjectFacade extends java.lang.Object implements IMavenProjectFacade, java.io.Serializable
Modifier and Type | Field and Description |
---|---|
private ArtifactKey |
artifactKey |
private java.util.Set<ArtifactRepositoryRef> |
artifactRepositories |
private java.util.Set<ArtifactRef> |
artifacts |
private org.eclipse.core.runtime.IPath[] |
compileSourceLocations |
private static java.lang.String |
CTX_EXECUTION_PLANS |
private static java.lang.String |
CTX_SETUP_EXECUTIONS |
private java.lang.String |
lifecycleMappingId |
private ProjectRegistryManager |
manager |
private java.util.List<java.lang.String> |
modules |
private java.util.Map<MojoExecutionKey,java.util.List<IPluginExecutionMetadata>> |
mojoExecutionMapping |
private org.eclipse.core.runtime.IPath |
outputLocation |
private java.lang.String |
packaging |
private java.util.Set<ArtifactRepositoryRef> |
pluginArtifactRepositories |
private org.eclipse.core.resources.IFile |
pom |
private java.io.File |
pomFile |
static java.lang.String |
PROP_CONFIGURATORS |
static java.lang.String |
PROP_LIFECYCLE_MAPPING |
private ResolverConfiguration |
resolverConfiguration |
private org.eclipse.core.runtime.IPath[] |
resourceLocations |
private static long |
serialVersionUID |
private java.util.Map<java.lang.String,java.lang.Object> |
sessionProperties |
private org.eclipse.core.runtime.IPath[] |
testCompileSourceLocations |
private org.eclipse.core.runtime.IPath |
testOutputLocation |
private org.eclipse.core.runtime.IPath[] |
testResourceLocations |
private long[] |
timestamp |
Constructor and Description |
---|
MavenProjectFacade(MavenProjectFacade other)
Copy constructor.
|
MavenProjectFacade(ProjectRegistryManager manager,
org.eclipse.core.resources.IFile pom,
org.apache.maven.project.MavenProject mavenProject,
ResolverConfiguration resolverConfiguration) |
Modifier and Type | Method and Description |
---|---|
private static <T> T[] |
arrayCopy(T[] a) |
private static boolean |
contains(java.lang.String[] goals,
java.lang.String goal) |
ArtifactKey |
getArtifactKey() |
java.util.Set<ArtifactRepositoryRef> |
getArtifactRepositoryRefs() |
org.eclipse.core.runtime.IPath[] |
getCompileSourceLocations() |
private static <T> T |
getContextValue(org.apache.maven.project.MavenProject mavenProject,
java.lang.String key) |
java.util.List<org.apache.maven.plugin.MojoExecution> |
getExecutionPlan(java.lang.String lifecycle,
org.eclipse.core.runtime.IProgressMonitor monitor) |
private java.util.Map<java.lang.String,java.util.List<org.apache.maven.plugin.MojoExecution>> |
getExecutionPlans(org.eclipse.core.runtime.IProgressMonitor monitor)
Maps LIFECYCLE_* to corresponding mojo executions.
|
org.eclipse.core.runtime.IPath |
getFullPath() |
org.eclipse.core.runtime.IPath |
getFullPath(java.io.File file)
Returns the full, absolute path of the given file relative to the workspace.
|
java.lang.String |
getLifecycleMappingId() |
org.apache.maven.project.MavenProject |
getMavenProject()
Returns cached MavenProject instance associated with this facade or
null , if the cache has not been
populated yet, for example right after workspace restart. |
org.apache.maven.project.MavenProject |
getMavenProject(org.eclipse.core.runtime.IProgressMonitor monitor)
Lazy load and cache MavenProject instance
|
java.util.Set<ArtifactRef> |
getMavenProjectArtifacts() |
java.util.List<java.lang.String> |
getMavenProjectModules() |
private static long |
getModificationStamp(org.eclipse.core.resources.IFile file) |
org.apache.maven.plugin.MojoExecution |
getMojoExecution(MojoExecutionKey mojoExecutionKey,
org.eclipse.core.runtime.IProgressMonitor monitor)
Returns fully setup MojoExecution instance bound to project build lifecycle that matches provided mojoExecutionKey.
|
java.util.Map<MojoExecutionKey,java.util.List<IPluginExecutionMetadata>> |
getMojoExecutionMapping() |
java.util.List<org.apache.maven.plugin.MojoExecution> |
getMojoExecutions()
Returns cached list of MojoExecutions bound to project's clean, default and site lifecycles.
|
java.util.List<org.apache.maven.plugin.MojoExecution> |
getMojoExecutions(org.eclipse.core.runtime.IProgressMonitor monitor)
Returns list of MojoExecutions bound to project's clean, default and site lifecycles.
|
java.util.List<org.apache.maven.plugin.MojoExecution> |
getMojoExecutions(java.lang.String groupId,
java.lang.String artifactId,
org.eclipse.core.runtime.IProgressMonitor monitor,
java.lang.String... goals)
Returns list of fully setup MojoExecution instances bound to project build lifecycle that matche provided groupId,
artifactId and (vararg) goals.
|
org.eclipse.core.runtime.IPath |
getOutputLocation()
Returns the full, absolute path of this project maven build output directory relative to the workspace or null if
maven build output directory cannot be determined or outside of the workspace.
|
java.lang.String |
getPackaging() |
java.util.Set<ArtifactRepositoryRef> |
getPluginArtifactRepositoryRefs() |
org.eclipse.core.resources.IFile |
getPom() |
java.io.File |
getPomFile() |
org.eclipse.core.resources.IProject |
getProject() |
org.eclipse.core.runtime.IPath |
getProjectRelativePath(java.lang.String resourceLocation)
Returns project resource for given file system location or null the location is outside of project.
|
ResolverConfiguration |
getResolverConfiguration() |
org.eclipse.core.runtime.IPath[] |
getResourceLocations()
Returns project relative paths of resource directories
|
java.lang.Object |
getSessionProperty(java.lang.String key) |
private java.util.Map<MojoExecutionKey,org.apache.maven.plugin.MojoExecution> |
getSetupMojoExecutions(org.eclipse.core.runtime.IProgressMonitor monitor)
Returns cache of fully setup MojoExecution instances.
|
org.eclipse.core.runtime.IPath[] |
getTestCompileSourceLocations() |
org.eclipse.core.runtime.IPath |
getTestOutputLocation()
Returns the full, absolute path of this project maven build test output directory relative to the workspace or null
if maven build output directory cannot be determined or outside of the workspace.
|
org.eclipse.core.runtime.IPath[] |
getTestResourceLocations()
Returns project relative paths of test resource directories
|
boolean |
isStale() |
private void |
putSetupMojoExecution(java.util.Map<MojoExecutionKey,org.apache.maven.plugin.MojoExecution> setupMojoExecutions,
MojoExecutionKey mojoExecutionKey,
org.apache.maven.plugin.MojoExecution execution) |
void |
setLifecycleMappingId(java.lang.String lifecycleMappingId) |
(package private) void |
setMavenProjectArtifacts(org.apache.maven.project.MavenProject mavenProject) |
void |
setMojoExecutionMapping(java.util.Map<MojoExecutionKey,java.util.List<IPluginExecutionMetadata>> mojoExecutionMapping) |
void |
setSessionProperty(java.lang.String key,
java.lang.Object value)
Associates the value with the key in session (i.e.
|
java.lang.String |
toString() |
private static final long serialVersionUID
private static final java.lang.String CTX_EXECUTION_PLANS
private static final java.lang.String CTX_SETUP_EXECUTIONS
public static final java.lang.String PROP_LIFECYCLE_MAPPING
public static final java.lang.String PROP_CONFIGURATORS
private final ProjectRegistryManager manager
private final org.eclipse.core.resources.IFile pom
private final java.io.File pomFile
private final ResolverConfiguration resolverConfiguration
private final long[] timestamp
private final ArtifactKey artifactKey
private final java.util.List<java.lang.String> modules
private final java.lang.String packaging
private final org.eclipse.core.runtime.IPath[] resourceLocations
private final org.eclipse.core.runtime.IPath[] testResourceLocations
private final org.eclipse.core.runtime.IPath[] compileSourceLocations
private final org.eclipse.core.runtime.IPath[] testCompileSourceLocations
private final org.eclipse.core.runtime.IPath outputLocation
private final org.eclipse.core.runtime.IPath testOutputLocation
private final java.util.Set<ArtifactRepositoryRef> artifactRepositories
private final java.util.Set<ArtifactRepositoryRef> pluginArtifactRepositories
private java.util.Set<ArtifactRef> artifacts
private java.lang.String lifecycleMappingId
private java.util.Map<MojoExecutionKey,java.util.List<IPluginExecutionMetadata>> mojoExecutionMapping
private transient java.util.Map<java.lang.String,java.lang.Object> sessionProperties
public MavenProjectFacade(ProjectRegistryManager manager, org.eclipse.core.resources.IFile pom, org.apache.maven.project.MavenProject mavenProject, ResolverConfiguration resolverConfiguration)
public MavenProjectFacade(MavenProjectFacade other)
private static <T> T[] arrayCopy(T[] a)
public org.eclipse.core.runtime.IPath[] getResourceLocations()
getResourceLocations
in interface IMavenProjectFacade
public org.eclipse.core.runtime.IPath[] getTestResourceLocations()
getTestResourceLocations
in interface IMavenProjectFacade
public org.eclipse.core.runtime.IPath[] getCompileSourceLocations()
getCompileSourceLocations
in interface IMavenProjectFacade
public org.eclipse.core.runtime.IPath[] getTestCompileSourceLocations()
getTestCompileSourceLocations
in interface IMavenProjectFacade
public org.eclipse.core.runtime.IPath getProjectRelativePath(java.lang.String resourceLocation)
getProjectRelativePath
in interface IMavenProjectFacade
resourceLocation
- absolute file system locationpublic org.eclipse.core.runtime.IPath getOutputLocation()
getOutputLocation
in interface IMavenProjectFacade
public org.eclipse.core.runtime.IPath getTestOutputLocation()
getTestOutputLocation
in interface IMavenProjectFacade
public org.eclipse.core.runtime.IPath getFullPath()
getFullPath
in interface IMavenProjectFacade
public org.apache.maven.project.MavenProject getMavenProject(org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
getMavenProject
in interface IMavenProjectFacade
org.eclipse.core.runtime.CoreException
public org.apache.maven.project.MavenProject getMavenProject()
IMavenProjectFacade
null
, if the cache has not been
populated yet, for example right after workspace restart. Clients must use
IMavenProjectFacade.getMavenProject(IProgressMonitor)
unless they are prepared to deal with null
return value.getMavenProject
in interface IMavenProjectFacade
public java.lang.String getPackaging()
getPackaging
in interface IMavenProjectFacade
public org.eclipse.core.resources.IProject getProject()
getProject
in interface IMavenProjectFacade
public org.eclipse.core.resources.IFile getPom()
getPom
in interface IMavenProjectFacade
public java.io.File getPomFile()
getPomFile
in interface IMavenProjectFacade
public org.eclipse.core.runtime.IPath getFullPath(java.io.File file)
getFullPath
in interface IMavenProjectFacade
public java.util.List<java.lang.String> getMavenProjectModules()
getMavenProjectModules
in interface IMavenProjectFacade
public java.util.Set<ArtifactRef> getMavenProjectArtifacts()
getMavenProjectArtifacts
in interface IMavenProjectFacade
void setMavenProjectArtifacts(org.apache.maven.project.MavenProject mavenProject)
public ResolverConfiguration getResolverConfiguration()
getResolverConfiguration
in interface IMavenProjectFacade
public boolean isStale()
isStale
in interface IMavenProjectFacade
private static long getModificationStamp(org.eclipse.core.resources.IFile file)
public ArtifactKey getArtifactKey()
getArtifactKey
in interface IMavenProjectFacade
public void setSessionProperty(java.lang.String key, java.lang.Object value)
IMavenProjectFacade
setSessionProperty
in interface IMavenProjectFacade
IMavenProjectFacade.getSessionProperty(String)
public java.lang.Object getSessionProperty(java.lang.String key)
getSessionProperty
in interface IMavenProjectFacade
IMavenProjectFacade.setSessionProperty(String, Object)
public java.util.Set<ArtifactRepositoryRef> getArtifactRepositoryRefs()
getArtifactRepositoryRefs
in interface IMavenProjectFacade
public java.util.Set<ArtifactRepositoryRef> getPluginArtifactRepositoryRefs()
getPluginArtifactRepositoryRefs
in interface IMavenProjectFacade
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getLifecycleMappingId()
getLifecycleMappingId
in interface IMavenProjectFacade
public void setLifecycleMappingId(java.lang.String lifecycleMappingId)
public java.util.Map<MojoExecutionKey,java.util.List<IPluginExecutionMetadata>> getMojoExecutionMapping()
getMojoExecutionMapping
in interface IMavenProjectFacade
public void setMojoExecutionMapping(java.util.Map<MojoExecutionKey,java.util.List<IPluginExecutionMetadata>> mojoExecutionMapping)
private java.util.Map<java.lang.String,java.util.List<org.apache.maven.plugin.MojoExecution>> getExecutionPlans(org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
org.eclipse.core.runtime.CoreException
private static <T> T getContextValue(org.apache.maven.project.MavenProject mavenProject, java.lang.String key)
private java.util.Map<MojoExecutionKey,org.apache.maven.plugin.MojoExecution> getSetupMojoExecutions(org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
org.eclipse.core.runtime.CoreException
public org.apache.maven.plugin.MojoExecution getMojoExecution(MojoExecutionKey mojoExecutionKey, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
IMavenProjectFacade
getMojoExecution
in interface IMavenProjectFacade
org.eclipse.core.runtime.CoreException
private void putSetupMojoExecution(java.util.Map<MojoExecutionKey,org.apache.maven.plugin.MojoExecution> setupMojoExecutions, MojoExecutionKey mojoExecutionKey, org.apache.maven.plugin.MojoExecution execution)
public java.util.List<org.apache.maven.plugin.MojoExecution> getMojoExecutions(java.lang.String groupId, java.lang.String artifactId, org.eclipse.core.runtime.IProgressMonitor monitor, java.lang.String... goals) throws org.eclipse.core.runtime.CoreException
IMavenProjectFacade
getMojoExecutions
in interface IMavenProjectFacade
org.eclipse.core.runtime.CoreException
private static boolean contains(java.lang.String[] goals, java.lang.String goal)
public java.util.List<org.apache.maven.plugin.MojoExecution> getMojoExecutions()
IMaven.setupMojoExecution(MavenSession, MavenProject, MojoExecution)
is required to execute and/or query mojo parameters. Similarly to getMavenProject()
, return value is null
after workspace restart.public java.util.List<org.apache.maven.plugin.MojoExecution> getMojoExecutions(org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
IMaven.setupMojoExecution(MavenSession, MavenProject, MojoExecution)
is required to
execute and/or query mojo parameters.org.eclipse.core.runtime.CoreException
public java.util.List<org.apache.maven.plugin.MojoExecution> getExecutionPlan(java.lang.String lifecycle, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
org.eclipse.core.runtime.CoreException