Class PluginUtils


  • public final class PluginUtils
    extends java.lang.Object
    Convenience methods to play with Maven plugins.
    Author:
    jdcasey
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String[] findSources​(java.lang.String basedir, java.lang.String include)  
      static java.lang.String[] findSources​(java.lang.String basedir, java.lang.String include, java.lang.String exclude)  
      static boolean isMavenReport​(java.lang.String mojoClassName, org.apache.maven.project.MavenProject project)  
      static void sortMojoParameters​(java.util.List<org.apache.maven.plugin.descriptor.Parameter> parameters)
      Sorts the specified mojo parameters by name.
      static void sortMojos​(java.util.List<org.apache.maven.plugin.descriptor.MojoDescriptor> mojoDescriptors)
      Sorts the specified mojo descriptors by goal name.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • findSources

        public static java.lang.String[] findSources​(java.lang.String basedir,
                                                     java.lang.String include)
        Parameters:
        basedir - not null
        include - not null
        Returns:
        list of included files with default SCM excluded files
      • findSources

        public static java.lang.String[] findSources​(java.lang.String basedir,
                                                     java.lang.String include,
                                                     java.lang.String exclude)
        Parameters:
        basedir - not null
        include - not null
        exclude - could be null
        Returns:
        list of included files
      • sortMojos

        public static void sortMojos​(java.util.List<org.apache.maven.plugin.descriptor.MojoDescriptor> mojoDescriptors)
        Sorts the specified mojo descriptors by goal name.
        Parameters:
        mojoDescriptors - The mojo descriptors to sort, may be null.
        See Also:
        MojoDescriptor.getGoal()
      • sortMojoParameters

        public static void sortMojoParameters​(java.util.List<org.apache.maven.plugin.descriptor.Parameter> parameters)
        Sorts the specified mojo parameters by name.
        Parameters:
        parameters - The mojo parameters to sort, may be null.
        Since:
        2.4.4
        See Also:
        Parameter.getName()
      • isMavenReport

        public static boolean isMavenReport​(java.lang.String mojoClassName,
                                            org.apache.maven.project.MavenProject project)
                                     throws java.lang.IllegalArgumentException
        Parameters:
        mojoClassName - a fully qualified Mojo implementation class name, not null
        project - a MavenProject instance, could be null
        Returns:
        true if the Mojo class implements MavenReport, false otherwise.
        Throws:
        java.lang.IllegalArgumentException - if any
        Since:
        3.10.0