You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Miłosz S (Jira)" <ji...@apache.org> on 2021/03/01 11:48:00 UTC
[jira] [Created] (MCLEAN-93) followSymLinks=false on Windows
follows directory junctions
Miłosz S created MCLEAN-93:
------------------------------
Summary: followSymLinks=false on Windows follows directory junctions
Key: MCLEAN-93
URL: https://issues.apache.org/jira/browse/MCLEAN-93
Project: Maven Clean Plugin
Issue Type: Bug
Affects Versions: 3.1.0, 3.0.0, 2.6.1
Reporter: Miłosz S
On Windows there are symlinks AND "junctions":
[https://docs.microsoft.com/en-us/windows/win32/fileio/hard-links-and-junctions]
And {{java.nio.file.Files.isSymbolicLink()}} is not detecting junctions, same like {{org.apache.maven.shared.utils.io.FileUtils}} from {{maven-shared-utils}}. To detect them, you should check for file attributes of given {{Path}}:
{code:java}
Path p = Paths.get("C:\\some\\path")
BasicFileAttributes attrs = Files.readAttributes(p, BasicFileAttributes.class, LinkOption.NOFOLLOW_LINKS);
boolean isJunction = attrs.isDirectory() && attrs.isOther();
{code}
^Above solution suggested [here on JDK JIRA|https://bugs.openjdk.java.net/browse/JDK-8031083?focusedCommentId=13444574&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-13444574]
Related issue: MCLEAN-58
--
This message was sent by Atlassian Jira
(v8.3.4#803005)