Class FileLocator

java.lang.Object
com.diffplug.spotless.maven.FileLocator

public class FileLocator extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
    FileLocator(org.codehaus.plexus.resource.ResourceManager resourceManager, File baseDir, File buildDir)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Finds the base directory of the Maven or Gradle project on which spotless is currently being executed.
    Finds the build directory (e.g.
    Finds the data directory that can be used for storing shared data such as downloaded files globally.
    If the given path is a local file returns it as such unchanged, otherwise extracts the given resource to a randomly-named file in the build folder.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • FileLocator

      public FileLocator(org.codehaus.plexus.resource.ResourceManager resourceManager, File baseDir, File buildDir)
  • Method Details

    • locateFile

      public File locateFile(String path)
      If the given path is a local file returns it as such unchanged, otherwise extracts the given resource to a randomly-named file in the build folder.
    • getBaseDir

      public File getBaseDir()
      Finds the base directory of the Maven or Gradle project on which spotless is currently being executed.
      Returns:
      The base directory of the current Maven or Gradel project.
    • getBuildDir

      public File getBuildDir()
      Finds the build directory (e.g. /target) of the Maven or Gradle project on which spotless is currently being executed.
      Returns:
      The project build directory of the current Maven or Gradle project.
    • getDataDir

      public File getDataDir()
      Finds the data directory that can be used for storing shared data such as downloaded files globally. This is a directory in the local repository, e.g. ~/.m2/repository/com/diffplus/spotless/spotless-data.
      Returns:
      The directory for storing shared data.