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 10
10
import java .net .URI ;
11
11
import java .net .URISyntaxException ;
12
12
import java .net .URL ;
13
+ import java .nio .file .FileSystemException ;
13
14
import java .nio .file .Files ;
14
15
import java .nio .file .Path ;
15
16
import java .nio .file .Paths ;
26
27
import io .quarkus .dev .spi .DevModeType ;
27
28
import io .quarkus .maven .dependency .ArtifactKey ;
28
29
import io .quarkus .paths .PathList ;
30
+ import io .smallrye .common .os .OS ;
29
31
30
32
/**
31
33
* The main entry point for the dev mojo execution
@@ -196,7 +198,18 @@ private void linkDotEnvFile() {
196
198
silentDeleteFile (link );
197
199
try {
198
200
// 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
+ }
200
213
} catch (IOException e ) {
201
214
log .warn ("Unable to link .env file" , e );
202
215
}
You can’t perform that action at this time.
0 commit comments