Package org.apache.maven.api.model
Class Build
java.lang.Object
org.apache.maven.api.model.PluginContainer
org.apache.maven.api.model.PluginConfiguration
org.apache.maven.api.model.BuildBase
org.apache.maven.api.model.Build
- All Implemented Interfaces:
Serializable
,InputLocationTracker
@Experimental
@Generated
@ThreadSafe
@Immutable
public class Build
extends BuildBase
implements Serializable, InputLocationTracker
The
<build>
element contains information required to build the project.
Default values are defined in Super POM.- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Builder class used to create Build instances. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Build
(Build.Builder builder) Constructor for this class, to be called from its subclasses andBuild.Builder
. -
Method Summary
Modifier and TypeMethodDescriptionA set of build extensions to use from this project.The directory where compiled application classes are placed.Deprecated.Deprecated.Replaced by<Source>
withmain
scope.All the sources to compile and resources files to copy for a project or it's unit tests.The directory where compiled test classes are placed.Deprecated.Replaced by<Source>
withtest
scope.static Build.Builder
Creates a newBuild
builder instance.static Build.Builder
newBuilder
(boolean withDefaults) Creates a newBuild
builder instance using default values or not.static Build.Builder
newBuilder
(Build from) Creates a newBuild
builder instance using the specified object as a basis.static Build.Builder
newBuilder
(Build from, boolean forceCopy) Creates a newBuild
builder instance using the specified object as a basis.static Build
Creates a newBuild
instance.static Build
newInstance
(boolean withDefaults) Creates a newBuild
instance using default values or not.toString()
with()
Creates a new builder with this object as the basis.withDefaultGoal
(String defaultGoal) Creates a newBuild
instance using the specified defaultGoal.withDirectory
(String directory) Creates a newBuild
instance using the specified directory.withExtensions
(Collection<Extension> extensions) Creates a newBuild
instance using the specified extensions.withFilters
(Collection<String> filters) Creates a newBuild
instance using the specified filters.withFinalName
(String finalName) Creates a newBuild
instance using the specified finalName.withOutputDirectory
(String outputDirectory) Creates a newBuild
instance using the specified outputDirectory.withPluginManagement
(PluginManagement pluginManagement) Creates a newBuild
instance using the specified pluginManagement.withPlugins
(Collection<Plugin> plugins) Creates a newBuild
instance using the specified plugins.withResources
(Collection<Resource> resources) Deprecated.withScriptSourceDirectory
(String scriptSourceDirectory) Deprecated.withSourceDirectory
(String sourceDirectory) Deprecated.withSources
(Collection<Source> sources) Creates a newBuild
instance using the specified sources.withTestOutputDirectory
(String testOutputDirectory) Creates a newBuild
instance using the specified testOutputDirectory.withTestResources
(Collection<Resource> testResources) Deprecated.withTestSourceDirectory
(String testSourceDirectory) Deprecated.Methods inherited from class org.apache.maven.api.model.BuildBase
getDefaultGoal, getDirectory, getFilters, getFinalName, getResources, getTestResources, newBuilder, newBuilder
Methods inherited from class org.apache.maven.api.model.PluginConfiguration
getPluginManagement, newBuilder, newBuilder
Methods inherited from class org.apache.maven.api.model.PluginContainer
getImportedFrom, getLocation, getLocationKeys, getLocationKeyStream, getPlugins, getPluginsAsMap, newBuilder, newBuilder
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.maven.api.model.InputLocationTracker
getImportedFrom, getLocation
-
Constructor Details
-
Build
Constructor for this class, to be called from its subclasses andBuild.Builder
.- See Also:
-
-
Method Details
-
getSources
All the sources to compile and resources files to copy for a project or it's unit tests. The sources can be Java source files, generated source files, scripts or resources for examples. Each source is specified by a mandatorydirectory
element, which is relative to the POM. The kind of sources (codes to compile or resources to copy) and their usage (for the main code or for the tests) is specified by thescope
element together with each source directory.- Returns:
- a
List<Source>
-
getSourceDirectory
Deprecated.Replaced by<Source>
withmain
scope.This element specifies a directory containing the source of the project. The generated build system will compile the sources from this directory when the project is built. The path given is relative to the project descriptor. The default value issrc/main/java
.- Returns:
- a
String
-
getScriptSourceDirectory
Deprecated.Replaced by<Source>
withscript
language.This element specifies a directory containing the script sources of the project. This directory is meant to be different from the sourceDirectory, in that its contents will be copied to the output directory in most cases (since scripts are interpreted rather than compiled). The default value issrc/main/scripts
.- Returns:
- a
String
-
getTestSourceDirectory
Deprecated.Replaced by<Source>
withtest
scope.This element specifies a directory containing the unit test source of the project. The generated build system will compile these directories when the project is being tested. The path given is relative to the project descriptor. The default value issrc/test/java
.- Returns:
- a
String
-
getOutputDirectory
The directory where compiled application classes are placed. The default value istarget/classes
.- Returns:
- a
String
-
getTestOutputDirectory
The directory where compiled test classes are placed. The default value istarget/test-classes
.- Returns:
- a
String
-
getExtensions
A set of build extensions to use from this project.- Returns:
- a
List<Extension>
-
with
Creates a new builder with this object as the basis. -
withPlugins
Creates a newBuild
instance using the specified plugins.- Overrides:
withPlugins
in classBuildBase
- Parameters:
plugins
- the newCollection<Plugin>
to use- Returns:
- a
Build
with the specified plugins
-
withPluginManagement
Creates a newBuild
instance using the specified pluginManagement.- Overrides:
withPluginManagement
in classBuildBase
- Parameters:
pluginManagement
- the newPluginManagement
to use- Returns:
- a
Build
with the specified pluginManagement
-
withDefaultGoal
Creates a newBuild
instance using the specified defaultGoal.- Overrides:
withDefaultGoal
in classBuildBase
- Parameters:
defaultGoal
- the newString
to use- Returns:
- a
Build
with the specified defaultGoal
-
withResources
Deprecated.Creates a newBuild
instance using the specified resources.- Overrides:
withResources
in classBuildBase
- Parameters:
resources
- the newCollection<Resource>
to use- Returns:
- a
Build
with the specified resources
-
withTestResources
@Deprecated(since="4.0.0") @Nonnull public Build withTestResources(Collection<Resource> testResources) Deprecated.Creates a newBuild
instance using the specified testResources.- Overrides:
withTestResources
in classBuildBase
- Parameters:
testResources
- the newCollection<Resource>
to use- Returns:
- a
Build
with the specified testResources
-
withDirectory
Creates a newBuild
instance using the specified directory.- Overrides:
withDirectory
in classBuildBase
- Parameters:
directory
- the newString
to use- Returns:
- a
Build
with the specified directory
-
withFinalName
Creates a newBuild
instance using the specified finalName.- Overrides:
withFinalName
in classBuildBase
- Parameters:
finalName
- the newString
to use- Returns:
- a
Build
with the specified finalName
-
withFilters
Creates a newBuild
instance using the specified filters.- Overrides:
withFilters
in classBuildBase
- Parameters:
filters
- the newCollection<String>
to use- Returns:
- a
Build
with the specified filters
-
withSources
Creates a newBuild
instance using the specified sources.- Parameters:
sources
- the newCollection<Source>
to use- Returns:
- a
Build
with the specified sources
-
withSourceDirectory
Deprecated.Creates a newBuild
instance using the specified sourceDirectory.- Parameters:
sourceDirectory
- the newString
to use- Returns:
- a
Build
with the specified sourceDirectory
-
withScriptSourceDirectory
@Deprecated(since="4.0.0") @Nonnull public Build withScriptSourceDirectory(String scriptSourceDirectory) Deprecated.Creates a newBuild
instance using the specified scriptSourceDirectory.- Parameters:
scriptSourceDirectory
- the newString
to use- Returns:
- a
Build
with the specified scriptSourceDirectory
-
withTestSourceDirectory
@Deprecated(since="4.0.0") @Nonnull public Build withTestSourceDirectory(String testSourceDirectory) Deprecated.Creates a newBuild
instance using the specified testSourceDirectory.- Parameters:
testSourceDirectory
- the newString
to use- Returns:
- a
Build
with the specified testSourceDirectory
-
withOutputDirectory
Creates a newBuild
instance using the specified outputDirectory.- Parameters:
outputDirectory
- the newString
to use- Returns:
- a
Build
with the specified outputDirectory
-
withTestOutputDirectory
Creates a newBuild
instance using the specified testOutputDirectory.- Parameters:
testOutputDirectory
- the newString
to use- Returns:
- a
Build
with the specified testOutputDirectory
-
withExtensions
Creates a newBuild
instance using the specified extensions.- Parameters:
extensions
- the newCollection<Extension>
to use- Returns:
- a
Build
with the specified extensions
-
newInstance
Creates a newBuild
instance. Equivalent tonewInstance(true)
.- Returns:
- a new
Build
- See Also:
-
newInstance
Creates a newBuild
instance using default values or not. Equivalent tonewBuilder(withDefaults).build()
.- Parameters:
withDefaults
- the boolean indicating whether default values should be used- Returns:
- a new
Build
-
newBuilder
Creates a newBuild
builder instance. Equivalent tonewBuilder(true)
.- Returns:
- a new
Builder
- See Also:
-
newBuilder
Creates a newBuild
builder instance using default values or not.- Parameters:
withDefaults
- the boolean indicating whether default values should be used- Returns:
- a new
Builder
-
newBuilder
Creates a newBuild
builder instance using the specified object as a basis. Equivalent tonewBuilder(from, false)
.- Parameters:
from
- theBuild
instance to use as a basis- Returns:
- a new
Builder
-
newBuilder
Creates a newBuild
builder instance using the specified object as a basis.- Parameters:
from
- theBuild
instance to use as a basisforceCopy
- the boolean indicating if a copy should be forced- Returns:
- a new
Builder
-
toString
-
<Source>
withscript
language.