public class MavenPlugin extends Object
Constructor and Description |
---|
MavenPlugin(org.apache.maven.model.Plugin plugin)
Creates a MavenPlugin based on a Plugin
|
MavenPlugin(String groupId,
String artifactId,
String version)
Creates a Maven plugin based on artifact + group + version
|
Modifier and Type | Method and Description |
---|---|
MavenPlugin |
addParameter(String key,
String value)
Adds a parameter to the maven plugin
|
org.codehaus.plexus.util.xml.Xpp3Dom |
getConfigurationXmlNode() |
String |
getParameter(String key)
Gets a parameter of the plugin based on its key
|
String[] |
getParameters(String key)
Gets a list of parameters of the plugin from a param key
|
org.apache.maven.model.Plugin |
getPlugin() |
static MavenPlugin |
getPlugin(org.apache.maven.project.MavenProject pom,
String groupId,
String artifactId)
Returns a plugin from a pom based on its group id and artifact id
|
boolean |
hasConfiguration() |
static MavenPlugin |
registerPlugin(org.apache.maven.project.MavenProject pom,
String groupId,
String artifactId,
String version,
boolean overrideVersion)
Registers a plugin in a project pom
|
void |
removeParameter(String key)
Remove a parameter from the maven plugin based on its key
|
void |
removeParameters()
Removes all parameters from the maven plugin
|
MavenPlugin |
setParameter(String key,
String value)
Sets a parameter for the maven plugin.
|
void |
setParameter(String key,
String value,
boolean override)
Sets a parameter to the maven plugin.
|
MavenPlugin |
setVersion(String version)
Sets the maven plugin version
|
String |
toString() |
public MavenPlugin(org.apache.maven.model.Plugin plugin)
plugin
- the pluginpublic MavenPlugin(String groupId, String artifactId, String version)
groupId
- the group idartifactId
- the artifact idversion
- the versionpublic org.codehaus.plexus.util.xml.Xpp3Dom getConfigurationXmlNode()
public MavenPlugin setVersion(String version)
version
- the versionpublic org.apache.maven.model.Plugin getPlugin()
public String getParameter(String key)
key
- the param keypublic String[] getParameters(String key)
key
- param key with option-index snippet: e.g. item[0], item[1]. If no index snippet is passed, then
0 is default (index <=> index[0])public MavenPlugin setParameter(String key, String value)
key
- the param keyvalue
- the param valuepublic void setParameter(String key, String value, boolean override)
key
- the param keyvalue
- the param valueoverride
- whether to override existing parameterpublic void removeParameters()
public MavenPlugin addParameter(String key, String value)
key
- the param key with option-index snippet: e.g. item[0], item[1]. If no index snippet is passed, then
0 is default (index <=> index[0])value
- the param valuepublic void removeParameter(String key)
key
- param key with option-index snippet: e.g. item[0], item[1]. If no index snippet is passed, then
0 is default (index <=> index[0])public boolean hasConfiguration()
public static MavenPlugin registerPlugin(org.apache.maven.project.MavenProject pom, String groupId, String artifactId, String version, boolean overrideVersion)
Adds the plugin if it does not exist or amend its version if it does exist and specified
pom
- the project pomgroupId
- the plugin group idartifactId
- the plugin artifact idversion
- the plugin versionoverrideVersion
- whether to override the version if the plugin is already registeredpublic static MavenPlugin getPlugin(org.apache.maven.project.MavenProject pom, String groupId, String artifactId)
It searches in the build section, then the reporting section and finally the pluginManagement section
pom
- the project pomgroupId
- the plugin group idartifactId
- the plugin artifact idCopyright © 2009-2013 SonarSource. All Rights Reserved.