org.sonar.api.batch.maven
Class MavenUtils

java.lang.Object
  extended by org.sonar.api.batch.maven.MavenUtils

public final class MavenUtils
extends java.lang.Object

An utility class to manipulate Maven concepts

Since:
1.10

Field Summary
static java.lang.String GROUP_ID_APACHE_MAVEN
           
static java.lang.String GROUP_ID_CODEHAUS_MOJO
           
 
Method Summary
static boolean equals(org.apache.maven.model.Plugin plugin, java.lang.String groupId, java.lang.String artifactId)
          Tests whether a plugin has got a given artifact id and group id
static boolean equals(org.apache.maven.model.ReportPlugin plugin, java.lang.String groupId, java.lang.String artifactId)
          Tests whether a ReportPlugin has got a given artifact id and group id
static java.lang.String getJavaSourceVersion(org.apache.maven.project.MavenProject pom)
           
static java.lang.String getJavaVersion(org.apache.maven.project.MavenProject pom)
          Returns the version of Java used by the maven compiler plugin
static org.apache.maven.model.Plugin getPlugin(java.util.Collection<org.apache.maven.model.Plugin> plugins, java.lang.String groupId, java.lang.String artifactId)
          Queries a collection of plugins based on a group id and an artifact id and returns the plugin if it exists
static java.nio.charset.Charset getSourceCharset(org.apache.maven.project.MavenProject pom)
          Returns the charset of a pom
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GROUP_ID_APACHE_MAVEN

public static final java.lang.String GROUP_ID_APACHE_MAVEN
See Also:
Constant Field Values

GROUP_ID_CODEHAUS_MOJO

public static final java.lang.String GROUP_ID_CODEHAUS_MOJO
See Also:
Constant Field Values
Method Detail

getJavaVersion

public static java.lang.String getJavaVersion(org.apache.maven.project.MavenProject pom)
Returns the version of Java used by the maven compiler plugin

Parameters:
pom - the project pom
Returns:
the java version

getJavaSourceVersion

public static java.lang.String getJavaSourceVersion(org.apache.maven.project.MavenProject pom)

getPlugin

public static org.apache.maven.model.Plugin getPlugin(java.util.Collection<org.apache.maven.model.Plugin> plugins,
                                                      java.lang.String groupId,
                                                      java.lang.String artifactId)
Queries a collection of plugins based on a group id and an artifact id and returns the plugin if it exists

Parameters:
plugins - the plugins collection
groupId - the group id
artifactId - the artifact id
Returns:
the corresponding plugin if it exists, null otherwise

equals

public static boolean equals(org.apache.maven.model.Plugin plugin,
                             java.lang.String groupId,
                             java.lang.String artifactId)
Tests whether a plugin has got a given artifact id and group id

Parameters:
plugin - the plugin to test
groupId - the group id
artifactId - the artifact id
Returns:
whether the plugin has got group + artifact ids

equals

public static boolean equals(org.apache.maven.model.ReportPlugin plugin,
                             java.lang.String groupId,
                             java.lang.String artifactId)
Tests whether a ReportPlugin has got a given artifact id and group id

Parameters:
plugin - the ReportPlugin to test
groupId - the group id
artifactId - the artifact id
Returns:
whether the ReportPlugin has got group + artifact ids

getSourceCharset

public static java.nio.charset.Charset getSourceCharset(org.apache.maven.project.MavenProject pom)
Returns the charset of a pom

Parameters:
pom - the project pom
Returns:
thee charset


Copyright © 2009-2010 SonarSource. All Rights Reserved.