Package org.codehaus.mojo.buildhelper
Class RootLocationMojo
java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.codehaus.mojo.buildhelper.AbstractDefinePropertyMojo
org.codehaus.mojo.buildhelper.RootLocationMojo
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled
,org.apache.maven.plugin.Mojo
@Mojo(name="rootlocation",
defaultPhase=VALIDATE,
threadSafe=true,
requiresProject=true)
public class RootLocationMojo
extends AbstractDefinePropertyMojo
This goal will get the location of the root folder within a multi module build as a property
rootlocation
.- Since:
- 3.0.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate org.apache.maven.project.ProjectBuilder
private String
The name of the property in which to store the root location.private boolean
This will cause the execution to be run only at the top of a given module tree.private org.apache.maven.execution.MavenSession
Fields inherited from class org.codehaus.mojo.buildhelper.AbstractDefinePropertyMojo
project
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
execute()
Main plugin executiongetAllChildModules
(org.apache.maven.project.MavenProject project) Returns a set of all child modules for a project, including any defined in profiles (ignoring profile activation).private void
getAllParentDirectories
(File directory, List<File> parents) getChildModuleCanoncialPath
(org.apache.maven.project.MavenProject project, List<String> modules) private org.apache.maven.project.MavenProject
getLocalRoot
(org.apache.maven.project.MavenProject project) Finds the local root of the specified project.Methods inherited from class org.codehaus.mojo.buildhelper.AbstractDefinePropertyMojo
defineProperty, getProject
Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Field Details
-
session
@Parameter(defaultValue="${session}", readonly=true, required=true) private org.apache.maven.execution.MavenSession session -
projectBuilder
@Component private org.apache.maven.project.ProjectBuilder projectBuilder -
runOnlyAtExecutionRoot
@Parameter(property="buildhelper.runOnlyAtExecutionRoot", defaultValue="false") private boolean runOnlyAtExecutionRootThis will cause the execution to be run only at the top of a given module tree. -
rootLocationProperty
The name of the property in which to store the root location.
-
-
Constructor Details
-
RootLocationMojo
public RootLocationMojo()
-
-
Method Details
-
execute
public void execute() throws org.apache.maven.plugin.MojoFailureExceptionMain plugin execution- Throws:
org.apache.maven.plugin.MojoFailureException
-
getLocalRoot
private org.apache.maven.project.MavenProject getLocalRoot(org.apache.maven.project.MavenProject project) throws IOException Finds the local root of the specified project.- Parameters:
project
- The project to find the local root for.- Returns:
- The local root project (this may be the current project)
- Throws:
IOException
-
getAllParentDirectories
-
getAllChildModules
private Set<String> getAllChildModules(org.apache.maven.project.MavenProject project) throws IOException Returns a set of all child modules for a project, including any defined in profiles (ignoring profile activation).- Parameters:
project
- The project.- Returns:
- the set of all child modules of the project (canonical paths).
- Throws:
IOException
-
getChildModuleCanoncialPath
private Set<String> getChildModuleCanoncialPath(org.apache.maven.project.MavenProject project, List<String> modules) throws IOException - Throws:
IOException
-