Class MavenUtils

java.lang.Object
de.oktoflow.platform.cmdTools.MavenUtils

public class MavenUtils extends Object
Some Maven utility functions. Taken over from Qualimaster.
Author:
Holger Eichelberger, Pastuschek
  • Field Details

  • Constructor Details

    • MavenUtils

      public MavenUtils()
  • Method Details

    • mavenRepository

      public static String mavenRepository()
      Returns the path to the maven repository.
      Returns:
      the path
    • cleanSnapshots

      public static MavenUtils.CleanupStatistics cleanSnapshots(int generations)
      Cleans up snapshots in the actual repository.
      Parameters:
      generations - the number of generations to keep (always at least 1)
      Returns:
      cleanup statistics
    • isSnapshotDir

      private static boolean isSnapshotDir(File file)
      Returns whether file is a snapshot directory.
      Parameters:
      file - the file to consider
      Returns:
      true for snapshot, false else
    • cleanSnapshotsInRepositoryDir

      private static void cleanSnapshotsInRepositoryDir(File base, int generations, MavenUtils.CleanupStatistics statistics)
      Cleans the snapshots in base.
      Parameters:
      base - the directory to clear recursively
      generations - the number of generations to keep
      statistics - cleanup statistics (to be modified as a side effect)
    • cleanSnapshots

      private static void cleanSnapshots(File dir, int generations, MavenUtils.CleanupStatistics statistics)
      Cleans the snapshots in dir.
      Parameters:
      dir - the directory to clear
      generations - the number of generations to keep
      statistics - cleanup statistics (to be modified as a side effect)
    • getGeneration

      private static final Integer getGeneration(String name)
      Returns the snapshot generation in name.
      Parameters:
      name - the file name
      Returns:
      the snapshot generation or null if none was identifier
    • humanReadableByteCount

      public static String humanReadableByteCount(long bytes, boolean si)
      Returns an amount of bytes in human readable format.
      Parameters:
      bytes - the number of bytes
      si - use SI units (based on 1000 if true) or 1024 as base (false)
      Returns:
      the human readable string representation