Package org.apache.maven.api.model
Class Plugin
java.lang.Object
org.apache.maven.api.model.ConfigurationContainer
org.apache.maven.api.model.Plugin
- All Implemented Interfaces:
Serializable
,InputLocationTracker
@Experimental
@Generated
@ThreadSafe
@Immutable
public class Plugin
extends ConfigurationContainer
implements Serializable, InputLocationTracker
The
<plugin>
element contains information required for a plugin.- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Builder class used to create Plugin instances. -
Constructor Summary
ModifierConstructorDescriptionprotected
Plugin
(Plugin.Builder builder) Constructor for this class, to be called from its subclasses andPlugin.Builder
. -
Method Summary
Modifier and TypeMethodDescriptionstatic String
constructKey
(String groupId, String artifactId) boolean
The artifact ID of the plugin in the repository.Additional dependencies that this project needs to introduce to the plugin's classloader.Multiple specifications of a set of goals to execute during the build lifecycle, each having (possibly) a different configuration.Whether to load Maven extensions (such as packaging and type handlers) from this plugin.The group ID of the plugin in the repository.getId()
Gets the identifier of the plugin.getKey()
getLocation
(Object key) Gets the location of the specified field in the input source.Gets the keys of the locations of the input source.The version (or valid range of versions) of the plugin to be used.int
hashCode()
boolean
static Plugin.Builder
Creates a newPlugin
builder instance.static Plugin.Builder
newBuilder
(boolean withDefaults) Creates a newPlugin
builder instance using default values or not.static Plugin.Builder
newBuilder
(Plugin from) Creates a newPlugin
builder instance using the specified object as a basis.static Plugin.Builder
newBuilder
(Plugin from, boolean forceCopy) Creates a newPlugin
builder instance using the specified object as a basis.static Plugin
Creates a newPlugin
instance.static Plugin
newInstance
(boolean withDefaults) Creates a newPlugin
instance using default values or not.toString()
with()
Creates a new builder with this object as the basis.withArtifactId
(String artifactId) Creates a newPlugin
instance using the specified artifactId.withConfiguration
(XmlNode configuration) Creates a newPlugin
instance using the specified configuration.withDependencies
(Collection<Dependency> dependencies) Creates a newPlugin
instance using the specified dependencies.withExecutions
(Collection<PluginExecution> executions) Creates a newPlugin
instance using the specified executions.withExtensions
(String extensions) Creates a newPlugin
instance using the specified extensions.withGroupId
(String groupId) Creates a newPlugin
instance using the specified groupId.withInherited
(String inherited) Creates a newPlugin
instance using the specified inherited.withVersion
(String version) Creates a newPlugin
instance using the specified version.Methods inherited from class org.apache.maven.api.model.ConfigurationContainer
getConfiguration, getImportedFrom, getInherited, isInherited, newBuilder, newBuilder
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.maven.api.model.InputLocationTracker
getImportedFrom
-
Constructor Details
-
Plugin
Constructor for this class, to be called from its subclasses andPlugin.Builder
.- See Also:
-
-
Method Details
-
getGroupId
The group ID of the plugin in the repository.- Returns:
- a
String
-
getArtifactId
The artifact ID of the plugin in the repository.- Returns:
- a
String
-
getVersion
The version (or valid range of versions) of the plugin to be used.- Returns:
- a
String
-
getExtensions
Whether to load Maven extensions (such as packaging and type handlers) from this plugin. For performance reasons, this should only be enabled when necessary. Note: While the type of this field isString
for technical reasons, the semantic type is actuallyBoolean
. Default value isfalse
.- Returns:
- a
String
-
getExecutions
Multiple specifications of a set of goals to execute during the build lifecycle, each having (possibly) a different configuration.- Returns:
- a
List<PluginExecution>
-
getDependencies
Additional dependencies that this project needs to introduce to the plugin's classloader.- Returns:
- a
List<Dependency>
-
getLocation
Gets the location of the specified field in the input source.- Specified by:
getLocation
in interfaceInputLocationTracker
- Overrides:
getLocation
in classConfigurationContainer
-
getLocationKeys
Gets the keys of the locations of the input source.- Overrides:
getLocationKeys
in classConfigurationContainer
-
with
Creates a new builder with this object as the basis.- Overrides:
with
in classConfigurationContainer
- Returns:
- a
Builder
-
withInherited
Creates a newPlugin
instance using the specified inherited.- Overrides:
withInherited
in classConfigurationContainer
- Parameters:
inherited
- the newString
to use- Returns:
- a
Plugin
with the specified inherited
-
withConfiguration
Creates a newPlugin
instance using the specified configuration.- Overrides:
withConfiguration
in classConfigurationContainer
- Parameters:
configuration
- the newXmlNode
to use- Returns:
- a
Plugin
with the specified configuration
-
withGroupId
Creates a newPlugin
instance using the specified groupId.- Parameters:
groupId
- the newString
to use- Returns:
- a
Plugin
with the specified groupId
-
withArtifactId
Creates a newPlugin
instance using the specified artifactId.- Parameters:
artifactId
- the newString
to use- Returns:
- a
Plugin
with the specified artifactId
-
withVersion
Creates a newPlugin
instance using the specified version.- Parameters:
version
- the newString
to use- Returns:
- a
Plugin
with the specified version
-
withExtensions
Creates a newPlugin
instance using the specified extensions.- Parameters:
extensions
- the newString
to use- Returns:
- a
Plugin
with the specified extensions
-
withExecutions
Creates a newPlugin
instance using the specified executions.- Parameters:
executions
- the newCollection<PluginExecution>
to use- Returns:
- a
Plugin
with the specified executions
-
withDependencies
Creates a newPlugin
instance using the specified dependencies.- Parameters:
dependencies
- the newCollection<Dependency>
to use- Returns:
- a
Plugin
with the specified dependencies
-
newInstance
Creates a newPlugin
instance. Equivalent tonewInstance(true)
.- Returns:
- a new
Plugin
- See Also:
-
newInstance
Creates a newPlugin
instance using default values or not. Equivalent tonewBuilder(withDefaults).build()
.- Parameters:
withDefaults
- the boolean indicating whether default values should be used- Returns:
- a new
Plugin
-
newBuilder
Creates a newPlugin
builder instance. Equivalent tonewBuilder(true)
.- Returns:
- a new
Builder
- See Also:
-
newBuilder
Creates a newPlugin
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 newPlugin
builder instance using the specified object as a basis. Equivalent tonewBuilder(from, false)
.- Parameters:
from
- thePlugin
instance to use as a basis- Returns:
- a new
Builder
-
newBuilder
Creates a newPlugin
builder instance using the specified object as a basis.- Parameters:
from
- thePlugin
instance to use as a basisforceCopy
- the boolean indicating if a copy should be forced- Returns:
- a new
Builder
-
isExtensions
public boolean isExtensions() -
getId
Gets the identifier of the plugin.- Returns:
- the plugin id in the form
<groupId>:<artifactId>:<version>
, nevernull
-
getKey
- Returns:
- the key of the plugin, ie
groupId:artifactId
-
constructKey
- Parameters:
groupId
- the group ID of the plugin in the repositoryartifactId
- the artifact ID of the reporting plugin in the repository- Returns:
- the key of the plugin, ie
groupId:artifactId
-
equals
-
hashCode
public int hashCode() -
toString
-