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 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 runOnlyAtExecutionRoot
      This will cause the execution to be run only at the top of a given module tree.
    • rootLocationProperty

      @Parameter(defaultValue="rootlocation") private String 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.MojoFailureException
      Main 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

      private void getAllParentDirectories(File directory, List<File> parents)
    • 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