Class MavenUtils
- java.lang.Object
-
- org.sonarsource.scanner.maven.bootstrap.MavenUtils
-
public final class MavenUtils extends Object
An utility class to manipulate Maven concepts- Since:
- 1.10
-
-
Field Summary
Fields Modifier and Type Field Description static StringGROUP_ID_APACHE_MAVENstatic StringGROUP_ID_CODEHAUS_MOJO
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> Tcoalesce(T... objs)Returns first non null object or null if all objects are nullstatic StringgetPluginSetting(org.apache.maven.project.MavenProject project, String groupId, String artifactId, String optionName, String defaultValue)Search for a configuration setting of an other plugin for a configuration setting.static StringgetSourceEncoding(org.apache.maven.project.MavenProject pom)
-
-
-
Field Detail
-
GROUP_ID_APACHE_MAVEN
public static final String GROUP_ID_APACHE_MAVEN
- See Also:
- Constant Field Values
-
GROUP_ID_CODEHAUS_MOJO
public static final String GROUP_ID_CODEHAUS_MOJO
- See Also:
- Constant Field Values
-
-
Method Detail
-
getSourceEncoding
@CheckForNull public static String getSourceEncoding(org.apache.maven.project.MavenProject pom)
- Parameters:
pom- the project pom- Returns:
- source encoding
-
getPluginSetting
public static String getPluginSetting(org.apache.maven.project.MavenProject project, String groupId, String artifactId, String optionName, @Nullable String defaultValue)
Search for a configuration setting of an other plugin for a configuration setting.- Parameters:
project- the current maven project to get the configuration from.groupId- the group id of the plugin to search forartifactId- the artifact id of the plugin to search foroptionName- the option to get from the configurationdefaultValue- the default value if the configuration was not found- Returns:
- the value of the option configured in the plugin configuration
-
coalesce
@SafeVarargs public static <T> T coalesce(T... objs)
Returns first non null object or null if all objects are null- Parameters:
objs-- Returns:
- First null argument, or null if they are all null
-
-