com.itemis.maven.plugins.unleash.util.functions.FileToRelativePath Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of unleash-maven-plugin Show documentation
Show all versions of unleash-maven-plugin Show documentation
This plugin provides a generic alternative to the error-prone default release plugin provided by Maven. It is designed to require a minimal effort of work for releasing modules and being extensible to integrate in every project setup.
package com.itemis.maven.plugins.unleash.util.functions;
import java.io.File;
import com.google.common.base.Function;
/**
* A function to convert a file's absolute path into the relative path starting from a reference file.
*
* @author Stanley Hillner
* @since 1.0.0
*/
public class FileToRelativePath implements Function {
private File workingDir;
public FileToRelativePath(File workingDir) {
this.workingDir = workingDir;
}
@Override
public String apply(File f) {
return this.workingDir.toURI().relativize(f.toURI()).toString();
}
}