Fix #49 Could not notify CliPluginRealmCache

This commit is contained in:
Peter Palaga
2020-08-01 10:52:48 +02:00
parent cd4d25333b
commit 7b189160be

View File

@@ -452,8 +452,18 @@ public class CliPluginRealmCache
final ValidableCacheRecord record = entry.getValue();
for (URL url : record.getRealm().getURLs()) {
if (url.getProtocol().equals("file")) {
final Path path = Paths.get(url.toURI()).toRealPath();
final Path path = Paths.get(url.toURI());
boolean remove = false;
if (path.startsWith(multiModuleProjectDirectory)) {
remove = true;
} else if (Files.exists(path)) {
/* Try to convert to real path only if the file exists */
final Path realPath = path.toRealPath();
if (realPath.startsWith(multiModuleProjectDirectory)) {
remove = true;
}
}
if (remove) {
log.debug(
"Removing PluginRealmCache entry {} because it refers to an artifact in the build tree {}",
entry.getKey(), path);