Class MavenUtils


  • public final class MavenUtils
    extends Object
    An utility class to manipulate Maven concepts
    Since:
    1.10
    • 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 for
        artifactId - the artifact id of the plugin to search for
        optionName - the option to get from the configuration
        defaultValue - 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