|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.sonar.api.batch.maven.MavenPlugin
public class MavenPlugin
A class to handle maven plugins
Constructor Summary | |
---|---|
MavenPlugin(org.apache.maven.model.Plugin plugin)
Creates a MavenPlugin based on a Plugin |
|
MavenPlugin(java.lang.String groupId,
java.lang.String artifactId,
java.lang.String version)
Creates a Maven plugin based on artifact + group + version |
Method Summary | |
---|---|
MavenPlugin |
addDependency(java.lang.String groupId,
java.lang.String artifactId,
java.lang.String version,
java.lang.String dependencyType)
Adds a dependency to the maven plugin |
MavenPlugin |
addParameter(java.lang.String key,
java.lang.String value)
Adds a parameter to the maven plugin |
java.lang.String |
getParameter(java.lang.String key)
Gets a parameter of the plugin based on its key |
java.lang.String[] |
getParameters(java.lang.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,
java.lang.String groupId,
java.lang.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,
java.lang.String groupId,
java.lang.String artifactId,
java.lang.String version,
boolean overrideVersion)
Registers a plugin in a project pom |
void |
removeParameter(java.lang.String key)
Remove a parameter from the maven plugin based on its key |
void |
removeParameters()
Removes all parameters from the maven plugin |
MavenPlugin |
setParameter(java.lang.String key,
java.lang.String value)
Sets a parameter for the maven plugin. |
void |
setParameter(java.lang.String key,
java.lang.String value,
boolean override)
Sets a parameter to the maven plugin. |
MavenPlugin |
setVersion(java.lang.String version)
Sets the maven plugin version |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public MavenPlugin(org.apache.maven.model.Plugin plugin)
plugin
- the pluginpublic MavenPlugin(java.lang.String groupId, java.lang.String artifactId, java.lang.String version)
groupId
- the group idartifactId
- the artifact idversion
- the versionMethod Detail |
---|
public MavenPlugin setVersion(java.lang.String version)
version
- the version
public org.apache.maven.model.Plugin getPlugin()
public MavenPlugin addDependency(java.lang.String groupId, java.lang.String artifactId, java.lang.String version, java.lang.String dependencyType)
groupId
- the dependency group idartifactId
- the dependency artifact idversion
- the dependency versiondependencyType
- the dependency type
public java.lang.String getParameter(java.lang.String key)
key
- the param key
public java.lang.String[] getParameters(java.lang.String key)
key
- the param key
public MavenPlugin setParameter(java.lang.String key, java.lang.String value)
key
- the param keyvalue
- the param value
public void setParameter(java.lang.String key, java.lang.String value, boolean override)
key
- the param keyvalue
- the param valueoverride
- whether to override existing parameterpublic void removeParameters()
public MavenPlugin addParameter(java.lang.String key, java.lang.String value)
key
- the param keyvalue
- the param value
public void removeParameter(java.lang.String key)
key
- the param keypublic boolean hasConfiguration()
public static MavenPlugin registerPlugin(org.apache.maven.project.MavenProject pom, java.lang.String groupId, java.lang.String artifactId, java.lang.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 registered
public static MavenPlugin getPlugin(org.apache.maven.project.MavenProject pom, java.lang.String groupId, java.lang.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 id
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |