Interface SourceRoot
- All Known Implementing Classes:
DefaultSourceRoot
public interface SourceRoot
A root directory of source files.
The sources may be Java main classes, test classes, resources or anything else identified by the scope.
Default values
The properties in this interface are defined in the<Source>
element of the
Maven project descriptor.
For each property, the default value is either empty or documented in the project descriptor.-
Method Summary
Modifier and TypeMethodDescriptiondefault Path
Returns the root directory where the sources are stored.default boolean
enabled()
Returns whether the directory described by this source element should be included in the build.excludes()
Returns the list of patterns for the files to exclude.includes()
Returns the list of patterns for the files to include.default Language
language()
Returns the language of the source files.matcher
(Collection<String> defaultIncludes, boolean useDefaultExcludes) Returns a matcher combining the include and exclude patterns.module()
Returns the name of the Java module (or other language-specific module) which is built by the sources.default ProjectScope
scope()
Returns in which context the source files will be used.default boolean
Returns whether resources are filtered to replace tokens with parameterized values.Returns an explicit target path, overriding the default value.Returns the version of the platform where the code will be executed.
-
Method Details
-
directory
Returns the root directory where the sources are stored.. The path is relative to the POM file.Default implementation
The default value depends on whether a module name is specified in this source root: The default value is relative. Implementation may override with absolute path instead.- Returns:
- the root directory where the sources are stored
-
includes
Returns the list of patterns for the files to include.. The path separator is/
on all platforms, including Windows. The prefix before the:
character, if present and longer than 1 character, is the syntax. If no syntax is specified, or if its length is 1 character (interpreted as a Windows drive), the default is a Maven-specific variation of the"glob"
pattern.The default implementation returns an empty list, which means to apply a language-dependent pattern. For example, for the Java language, the pattern includes all files with the
.java
suffix.- Returns:
- the list of patterns for the files to include
- See Also:
-
excludes
-
matcher
Returns a matcher combining the include and exclude patterns.. If the user did not specify any includes, the givendefaultIncludes
are used. These defaults depend on the plugin. For example, the default include of the Java compiler plugin is"**/*.java"
.If the user did not specify any excludes, the default is often files generated by Source Code Management (SCM) software or by the operating system. Examples:
"**/.gitignore"
,"**/.DS_Store"
.- Parameters:
defaultIncludes
- the default includes if unspecified by the useruseDefaultExcludes
- whether to add the default set of patterns to exclude, mostly Source Code Management (SCM) files- Returns:
- a matcher combining the include and exclude patterns
-
scope
Returns in which context the source files will be used.. Not to be confused with dependency scope. The default value is"main"
.- Returns:
- in which context the source files will be used
- See Also:
-
language
Returns the language of the source files.. The default value is"java"
.- Returns:
- the language of the source files
- See Also:
-
module
-
targetVersion
-
targetPath
Returns an explicit target path, overriding the default value.. When a target path is explicitly specified, the values of themodule()
andtargetVersion()
elements are not used for inferring the path (they are still used as compiler options however). It means that for scripts and resources, the files below the path specified bydirectory()
are copied to the path specified bytargetPath()
with the exact same directory structure.- Returns:
- an explicit target path, overriding the default value
-
stringFiltering
default boolean stringFiltering()Returns whether resources are filtered to replace tokens with parameterized values.. The default value isfalse
.- Returns:
- whether resources are filtered to replace tokens with parameterized values
-
enabled
default boolean enabled()Returns whether the directory described by this source element should be included in the build.. The default value istrue
.- Returns:
- whether the directory described by this source element should be included in the build
-