You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2022/01/10 14:54:33 UTC

[GitHub] [maven-clean-plugin] gnodet opened a new pull request #10: [MCLEAN-93] Support junctions on NTFS

gnodet opened a new pull request #10:
URL: https://github.com/apache/maven-clean-plugin/pull/10


   [MCLEAN-93](https://issues.apache.org/jira/projects/MCLEAN/issues/MCLEAN-93)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven-clean-plugin] gnodet edited a comment on pull request #10: [MCLEAN-93] Support junctions on NTFS

Posted by GitBox <gi...@apache.org>.
gnodet edited a comment on pull request #10:
URL: https://github.com/apache/maven-clean-plugin/pull/10#issuecomment-1009093211


   > When can this happen? I mean, can we create a junction in Java without using native code?
   
   I'm going to experiment with something like:
   ```
           Path testDir = Paths.get( "target/test-dir" ).toAbsolutePath();
           Files.createDirectories( testDir );
           Path orgDir = testDir.resolve( "org-dir" );
           Path jctDir = testDir.resolve( "jct-dir" );
           Files.createDirectories( orgDir );
   
           Process process = new ProcessBuilder()
                   .directory( testDir.toFile() )
                   .command( "mklink", "/J", jctDir.toString(), orgDir.toString() )
                   .start();
           int result = process.waitFor();
   ```
   The idea comes from https://www.geeksforgeeks.org/creating-junction-points/


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven-clean-plugin] gnodet commented on pull request #10: [MCLEAN-93] Support junctions on NTFS

Posted by GitBox <gi...@apache.org>.
gnodet commented on pull request #10:
URL: https://github.com/apache/maven-clean-plugin/pull/10#issuecomment-1009758033


   > When can this happen? I mean, can we create a junction in Java without using native code?
   
   The test is here: https://github.com/apache/maven-clean-plugin/pull/10/files#diff-f51e0a6f6bcc199bb061d2f1b751c0740ae8cd016a1e87b5349758c4ee96e7d1R297-R321


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven-clean-plugin] gnodet commented on pull request #10: [MCLEAN-93] Support junctions on NTFS

Posted by GitBox <gi...@apache.org>.
gnodet commented on pull request #10:
URL: https://github.com/apache/maven-clean-plugin/pull/10#issuecomment-1009093211


   > When can this happen? I mean, can we create a junction in Java without using native code?
   
   I'm experimenting with something like:
   ```
           Path testDir = Paths.get( "target/test-dir" ).toAbsolutePath();
           Files.createDirectories( testDir );
           Path orgDir = testDir.resolve( "org-dir" );
           Path jctDir = testDir.resolve( "jct-dir" );
           Files.createDirectories( orgDir );
   
           Process process = new ProcessBuilder()
                   .directory( testDir.toFile() )
                   .command( "mklink", "/J", jctDir.toString(), orgDir.toString() )
                   .start();
           int result = process.waitFor();
   ```
   The idea comes from https://www.geeksforgeeks.org/creating-junction-points/


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven-clean-plugin] gnodet edited a comment on pull request #10: [MCLEAN-93] Support junctions on NTFS

Posted by GitBox <gi...@apache.org>.
gnodet edited a comment on pull request #10:
URL: https://github.com/apache/maven-clean-plugin/pull/10#issuecomment-1009758033


   > When can this happen? I mean, can we create a junction in Java without using native code?
   
   @michael-o The test is here: https://github.com/apache/maven-clean-plugin/pull/10/files#diff-f51e0a6f6bcc199bb061d2f1b751c0740ae8cd016a1e87b5349758c4ee96e7d1R297-R321


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven-clean-plugin] gnodet commented on pull request #10: [MCLEAN-93] Support junctions on NTFS

Posted by GitBox <gi...@apache.org>.
gnodet commented on pull request #10:
URL: https://github.com/apache/maven-clean-plugin/pull/10#issuecomment-1009030242


   I'm investigating if I can setup a test on windows.  I've been sidetracked by trying to switch the tests to junit 5 / plexus-testing, but it's missing the helper methods to setup/lookup mojos...
   I'll provide one asap.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven-clean-plugin] gnodet commented on a change in pull request #10: [MCLEAN-93] Support junctions on NTFS

Posted by GitBox <gi...@apache.org>.
gnodet commented on a change in pull request #10:
URL: https://github.com/apache/maven-clean-plugin/pull/10#discussion_r781361531



##########
File path: src/main/java/org/apache/maven/plugins/clean/Cleaner.java
##########
@@ -297,6 +299,12 @@ else if ( file.exists() )
         return result;
     }
 
+    private boolean isSymbolicLink( Path path ) throws IOException
+    {
+        BasicFileAttributes attrs = Files.readAttributes( path, BasicFileAttributes.class, LinkOption.NOFOLLOW_LINKS );
+        return attrs.isSymbolicLink() || ( attrs.isDirectory() && attrs.isOther() );

Review comment:
       I'm experimenting with something like:
   ```
           Path testDir = Paths.get( "target/test-dir" ).toAbsolutePath();
           Files.createDirectories( testDir );
           Path orgDir = testDir.resolve( "org-dir" );
           Path jctDir = testDir.resolve( "jct-dir" );
           Files.createDirectories( orgDir );
   
           Process process = new ProcessBuilder()
                   .directory( testDir.toFile() )
                   .command( "mklink", "/J", jctDir.toString(), orgDir.toString() )
                   .start();
           int result = process.waitFor();
   ```
   The idea comes from https://www.geeksforgeeks.org/creating-junction-points/




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven-clean-plugin] michael-o commented on a change in pull request #10: [MCLEAN-93] Support junctions on NTFS

Posted by GitBox <gi...@apache.org>.
michael-o commented on a change in pull request #10:
URL: https://github.com/apache/maven-clean-plugin/pull/10#discussion_r781335089



##########
File path: src/main/java/org/apache/maven/plugins/clean/Cleaner.java
##########
@@ -297,6 +299,12 @@ else if ( file.exists() )
         return result;
     }
 
+    private boolean isSymbolicLink( Path path ) throws IOException
+    {
+        BasicFileAttributes attrs = Files.readAttributes( path, BasicFileAttributes.class, LinkOption.NOFOLLOW_LINKS );
+        return attrs.isSymbolicLink() || ( attrs.isDirectory() && attrs.isOther() );

Review comment:
       Can you add a comment here  that the right hand part represents a junction?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org