Class MojoHelper

java.lang.Object
org.codehaus.mojo.license.utils.MojoHelper

public class MojoHelper extends Object
Mojo helper methods.
Since:
1.0
Author:
tchemit dev@tchemit.fr
  • Field Details

    • TIME_FACTORS

      protected static final double[] TIME_FACTORS
    • TIME_UNITES

      protected static final String[] TIME_UNITES
  • Constructor Details

    • MojoHelper

      public MojoHelper()
  • Method Details

    • addResourceDir

      public static boolean addResourceDir(File dir, org.apache.maven.project.MavenProject project, String... includes)
      Add the directory as a resource of the given project.
      Parameters:
      dir - the directory to add
      project - the project to update
      includes - the includes of the resource
      Returns:
      true if the resources was added (not already existing)
    • addResourceDir

      public static boolean addResourceDir(File dir, org.apache.maven.project.MavenProject project, List<?> resources, String... includes)
      Add the directory as a resource in the given resource list.
      Parameters:
      dir - the directory to add
      project - the project involved
      resources - the list of existing resources
      includes - includes of the new resources
      Returns:
      true if the resource was added (not already existing)
    • newMavenProjectComparator

      public static Comparator<org.apache.maven.project.MavenProject> newMavenProjectComparator()
    • newMavenProjectComparatorByName

      public static Comparator<org.apache.maven.project.MavenProject> newMavenProjectComparatorByName()
    • convertTime

      public static String convertTime(long value)
    • convert

      public static String convert(long value, double[] factors, String[] unites)
    • getUrl

      public static URL getUrl(URL baseUrl, String suffix)
      suffix a given baseUrl with the given suffix
      Parameters:
      baseUrl - base url to use
      suffix - suffix to add
      Returns:
      the new url
    • getArtifactId

      public static String getArtifactId(org.apache.maven.artifact.Artifact artifact)
    • getArtifactName

      public static String getArtifactName(org.apache.maven.project.MavenProject project)
    • getProjectName

      public static String getProjectName(org.apache.maven.project.MavenProject project)
    • getParams

      public static List<String> getParams(String params)
    • getDependencyArtifacts

      public static Set<org.apache.maven.artifact.Artifact> getDependencyArtifacts(org.apache.maven.project.MavenProject project)
      MavenProject.getDependencyArtifacts() is deprecated.

      This method checks if the dependency artifacts is null and returns an empty HashSet to avoid the NullPointerExceptions caused by the MavenProject.getDependencyArtifacts() returning null.

      Parameters:
      project - the MavenProject to retrieve artifacts from
      Returns:
      a HashSet of dependencies or an empty set