Package com.mayam.wf.siteconfig
Class Artifacts
java.lang.Object
com.mayam.wf.siteconfig.Artifacts
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
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
An artifact information bean, holding identifiers and version. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Artifacts.Artifact
artifactByJarPath
(String path) static Artifacts.Artifact
artifactByJarUrl
(URL url) static Artifacts.Artifact
getArtifact
(ClassLoader classLoader, String groupId, String artifactId) Detects version number and packaging for an identified artifact.static Artifacts.Artifact
getArtifact
(String groupId, String artifactId) Detects version number and packaging for an identified artifact.static void
Logs all artifacts found on the classpath.static List
<Artifacts.Artifact> Scans the classpath and returns a list of all artifacts found.static Optional
<Artifacts.Artifact> If applicable, returns an Artifact describing the war file making up the bulk of the current classpath.
-
Constructor Details
-
Artifacts
public Artifacts()
-
-
Method Details
-
getArtifact
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
Scans the classpath and returns a list of all artifacts found.- Returns:
- list of artifacts on classpath.
-
artifactByJarPath
- Throws:
MalformedURLException
-
artifactByJarUrl
-
webappArtifact
If applicable, returns an Artifact describing the war file making up the bulk of the current classpath.
-