Class DefaultSourceRoot

java.lang.Object
org.apache.maven.impl.DefaultSourceRoot
All Implemented Interfaces:
SourceRoot

public final class DefaultSourceRoot extends Object implements SourceRoot
A default implementation of SourceRoot built from the model.
  • Constructor Details

    • DefaultSourceRoot

      public DefaultSourceRoot(Session session, Path baseDir, Source source)
      Creates a new instance from the given model.
      Parameters:
      session - the session of resolving extensible enumerations
      baseDir - the base directory for resolving relative paths
      source - a source element from the model
    • DefaultSourceRoot

      public DefaultSourceRoot(Path baseDir, ProjectScope scope, Resource resource)
      Creates a new instance from the given resource. This is used for migration from the previous way of declaring resources.
      Parameters:
      baseDir - the base directory for resolving relative paths
      scope - the scope of the resource (main or test)
      resource - a resource element from the model
    • DefaultSourceRoot

      public DefaultSourceRoot(ProjectScope scope, Language language, Path directory)
      Creates a new instance for the given directory and scope.
      Parameters:
      scope - scope of source code (main or test)
      language - language of the source code
      directory - directory of the source code
    • DefaultSourceRoot

      public DefaultSourceRoot(ProjectScope scope, Language language, Path directory, List<PathMatcher> includes, List<PathMatcher> excludes)
      Creates a new instance for the given directory and scope.
      Parameters:
      scope - scope of source code (main or test)
      language - language of the source code
      directory - directory of the source code
  • Method Details

    • directory

      public Path directory()
      Returns the root directory where the sources are stored..
      Specified by:
      directory in interface SourceRoot
      Returns:
      the root directory where the sources are stored
    • includes

      public List<PathMatcher> includes()
      Returns the list of pattern matchers for the files to include..
      Specified by:
      includes in interface SourceRoot
      Returns:
      the list of pattern matchers for the files to include
    • excludes

      public List<PathMatcher> excludes()
      Returns the list of pattern matchers for the files to exclude..
      Specified by:
      excludes in interface SourceRoot
      Returns:
      the list of pattern matchers for the files to exclude
    • scope

      public ProjectScope scope()
      Returns in which context the source files will be used..
      Specified by:
      scope in interface SourceRoot
      Returns:
      in which context the source files will be used
    • language

      public Language language()
      Returns the language of the source files..
      Specified by:
      language in interface SourceRoot
      Returns:
      the language of the source files
    • module

      public Optional<String> module()
      Returns the name of the Java module (or other language-specific module) which is built by the sources..
      Specified by:
      module in interface SourceRoot
      Returns:
      the name of the Java module (or other language-specific module) which is built by the sources
    • targetVersion

      public Optional<Version> targetVersion()
      Returns the version of the platform where the code will be executed..
      Specified by:
      targetVersion in interface SourceRoot
      Returns:
      the version of the platform where the code will be executed
    • targetPath

      public Optional<Path> targetPath()
      Returns an explicit target path, overriding the default value..
      Specified by:
      targetPath in interface SourceRoot
      Returns:
      an explicit target path, overriding the default value
    • stringFiltering

      public boolean stringFiltering()
      Returns whether resources are filtered to replace tokens with parameterized values..
      Specified by:
      stringFiltering in interface SourceRoot
      Returns:
      whether resources are filtered to replace tokens with parameterized values
    • enabled

      public boolean enabled()
      Returns whether the directory described by this source element should be included in the build..
      Specified by:
      enabled in interface SourceRoot
      Returns:
      whether the directory described by this source element should be included in the build
    • hashCode

      public int hashCode()
      Returns a hash code value computed from all properties..
      Overrides:
      hashCode in class Object
      Returns:
      a hash code value computed from all properties
    • equals

      public boolean equals(Object obj)
      Returns whether the two objects are of the same class with equal property values..
      Overrides:
      equals in class Object
      Parameters:
      obj - the other object to compare with this object, or null
      Returns:
      whether the two objects are of the same class with equal property values