File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
core/deployment/src/main/java/io/quarkus/deployment/dev Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change 1010import java .net .URI ;
1111import java .net .URISyntaxException ;
1212import java .net .URL ;
13+ import java .nio .file .FileSystemException ;
1314import java .nio .file .Files ;
1415import java .nio .file .Path ;
1516import java .nio .file .Paths ;
2627import io .quarkus .dev .spi .DevModeType ;
2728import io .quarkus .maven .dependency .ArtifactKey ;
2829import io .quarkus .paths .PathList ;
30+ import io .smallrye .common .os .OS ;
2931
3032/**
3133 * The main entry point for the dev mojo execution
@@ -196,7 +198,18 @@ private void linkDotEnvFile() {
196198 silentDeleteFile (link );
197199 try {
198200 // create a symlink to ensure that user updates to the file have the expected effect in dev-mode
199- Files .createSymbolicLink (link , dotEnvPath );
201+ try {
202+ Files .createSymbolicLink (link , dotEnvPath );
203+ } catch (FileSystemException e ) {
204+ // on Windows fall back to hard link if symlink cannot be created (due to insufficient permissions)
205+ // see https://github.com/quarkusio/quarkus/issues/49785
206+ if (OS .WINDOWS .isCurrent ()) {
207+ log .debug ("Falling back to hard link on Windows after FileSystemException" , e );
208+ Files .createLink (link , dotEnvPath );
209+ } else {
210+ throw e ;
211+ }
212+ }
200213 } catch (IOException e ) {
201214 log .warn ("Unable to link .env file" , e );
202215 }
You can’t perform that action at this time.
0 commit comments