All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.teamtter.mavennatives.nativedependencies.UnpackedArtifactsInfo Maven / Gradle / Ivy

Go to download

This plugin allows the automatic unpacking of natives in jars depending on a classifier with a certain pattern. It is a fork from http://code.google.com/p/mavennatives/ . Thanks to the original authors [email protected] and [email protected] !

There is a newer version: 1.0.6
Show newest version
package com.teamtter.mavennatives.nativedependencies;

import java.io.File;
import java.nio.file.Path;
import java.util.HashMap;
import java.util.Map;

import lombok.Data;

@Data
public class UnpackedArtifactsInfo {

	private Map pathToLastModified = new HashMap<>();

	public void flagAsUnpacked(File file) {
		Path normalizedPath = file.toPath().normalize();
		String pathAsString = normalizedPath.toString();
		long lastModified = file.lastModified();
		pathToLastModified.put(pathAsString, lastModified);
	}

	public boolean containsExactly(File currentArtifactFile) {
		boolean contains = false;
		String normalizedPath = currentArtifactFile.toPath().normalize().toString();
		Long lastModifiedDate = pathToLastModified.get(normalizedPath);
		if (lastModifiedDate != null) {
			long currentArtifactLastModifiedDate = currentArtifactFile.lastModified();
			if (currentArtifactLastModifiedDate == lastModifiedDate) {
				contains = true;
			}
		}
		return contains;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy