Package org.apache.maven.buildcache
Class CacheUtils
java.lang.Object
org.apache.maven.buildcache.CacheUtils
Cache Utils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> voiddebugPrintCollection(org.slf4j.Logger logger, Collection<T> values, String heading, String elementCaption) static <T> Tstatic PathgetMultimoduleRoot(org.apache.maven.execution.MavenSession session) static booleanstatic booleanisPom(org.apache.maven.model.Dependency dependency) static booleanisPom(org.apache.maven.project.MavenProject project) static booleanisSnapshot(String version) static StringmojoExecutionKey(org.apache.maven.plugin.MojoExecution mojo) static StringnormalizedName(org.apache.maven.artifact.Artifact artifact) static ScmreadGitInfo(org.apache.maven.execution.MavenSession session) static voidstatic booleanPut every matching files of a directory in a zip.
-
Constructor Details
-
CacheUtils
public CacheUtils()
-
-
Method Details
-
isPom
public static boolean isPom(org.apache.maven.project.MavenProject project) -
isPom
public static boolean isPom(org.apache.maven.model.Dependency dependency) -
isSnapshot
-
normalizedName
-
mojoExecutionKey
-
getMultimoduleRoot
-
readGitInfo
- Throws:
IOException
-
getLast
-
isArchive
-
zip
public static boolean zip(Path dir, Path zip, String glob, boolean preservePermissions) throws IOException Put every matching files of a directory in a zip.- Parameters:
dir- directory to zipzip- zip to populateglob- glob to apply to filenamespreservePermissions- whether to preserve Unix file permissions in the zip.Important: When
true, permissions are stored in ZIP entry headers, which means they become part of the ZIP file's binary content. As a result, hashing the ZIP file (e.g., for cache keys) will include permission information, ensuring cache invalidation when file permissions change. This behavior is similar to how Git includes file mode in tree hashes.- Returns:
- true if at least one file has been included in the zip.
- Throws:
IOException
-
unzip
- Throws:
IOException
-
debugPrintCollection
public static <T> void debugPrintCollection(org.slf4j.Logger logger, Collection<T> values, String heading, String elementCaption)
-