Class Artifacts

java.lang.Object
com.mayam.wf.siteconfig.Artifacts

public class Artifacts extends Object
Borrowing heavily from the Maven Runtime, this utility class extracts version strings for individual known artifacts or scans the classpath for all existing artifacts.
Author:
Markus Mårtensson
  • Constructor Details

    • Artifacts

      public Artifacts()
  • Method Details

    • getArtifact

      public static Artifacts.Artifact getArtifact(String groupId, String artifactId)
      Detects version number and packaging for an identified artifact.
      Parameters:
      groupId - group identifier.
      artifactId - artifact identifier.
      Returns:
      version string, or "unknown" if unable to detect.
    • getArtifact

      public static Artifacts.Artifact getArtifact(ClassLoader classLoader, String groupId, String artifactId)
      Detects version number and packaging for an identified artifact.  @param classLoader class loader; such as siteConfig.classLoader().
      Parameters:
      groupId - group identifier.
      artifactId - artifact identifier.
      Returns:
      artifact information.
    • logArtifactVersions

      public static void logArtifactVersions()
      Logs all artifacts found on the classpath.
    • scanArtifacts

      public static List<Artifacts.Artifact> scanArtifacts()
      Scans the classpath and returns a list of all artifacts found.
      Returns:
      list of artifacts on classpath.
    • artifactByJarPath

      public static Artifacts.Artifact artifactByJarPath(String path) throws MalformedURLException
      Throws:
      MalformedURLException
    • artifactByJarUrl

      public static Artifacts.Artifact artifactByJarUrl(URL url)
    • webappArtifact

      public static Optional<Artifacts.Artifact> webappArtifact()
      If applicable, returns an Artifact describing the war file making up the bulk of the current classpath.