Class MavenUtils
java.lang.Object
org.sonarsource.scanner.maven.bootstrap.MavenUtils
An utility class to manipulate Maven concepts
- Since:
- 1.10
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> T
coalesce
(T... objs) Returns first non null object or null if all objects are nullstatic String
getPluginSetting
(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 String
getSourceEncoding
(org.apache.maven.project.MavenProject pom) static String
Joins a list of strings that may contain commas by wrapping those strings in double quotes, like in CSV format.splitAsCsv
(String joined)
-
Field Details
-
GROUP_ID_APACHE_MAVEN
- See Also:
-
GROUP_ID_CODEHAUS_MOJO
- See Also:
-
-
Method Details
-
getSourceEncoding
- 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
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
-
joinAsCsv
Joins a list of strings that may contain commas by wrapping those strings in double quotes, like in CSV format.For example: values = { "/home/users/me/artifact-123,456.jar", "/opt/lib" } return is the string: "\"/home/users/me/artifact-123,456.jar\",/opt/lib"
- Parameters:
values
-- Returns:
- a string having all the values separated by commas and each single value that contains a comma wrapped in double quotes
-
splitAsCsv
-