Gradle 取相對路徑

import java.nio.file.Path;
import java.nio.file.Paths;

def path1 = ...
def path2 = ...

task hello {
    Path pathBase = Paths.get(path1);
    Path pathAbsolute = Paths.get(path2);
    Path pathRelative = pathBase.relativize(pathAbsolute);
    print pathRelative
}
相關文章
相關標籤/搜索