@@ -48,6 +48,8 @@ public class DevModeMojo extends CommonDevMojo {
4848 private final Path explodedWarDir = Paths .get (project .getBuild ().getDirectory (), project .getBuild ().getFinalName ());
4949 @ Getter (lazy = true )
5050 private final Path srcMainDir = Paths .get (project .getBasedir ().getAbsolutePath (), "src" , "main" );
51+ @ Getter (lazy = true )
52+ private final String appURL = computeApplicationURL ();
5153
5254 @ Override
5355 @ SneakyThrows (IOException .class )
@@ -79,11 +81,10 @@ private void enableOrDeploy() throws IOException {
7981 }
8082 deployer .sendDeployCommand (deployer ::printResponse , 0 );
8183 }
82- String httpUrl = payaraAminURL .replaceFirst (":\\ d+$" , ":" + payaraHttpPort );
83- var browseURL = URI .create ("%s/%s" .formatted (httpUrl , project .getBuild ().getFinalName ()));
84- getLog ().info ("Application URL at " + browseURL );
84+
85+ getLog ().info ("Application URL at " + getAppURL ());
8586 try {
86- Desktop .getDesktop ().browse (browseURL );
87+ Desktop .getDesktop ().browse (URI . create ( getAppURL ()) );
8788 } catch (UnsupportedOperationException e ) {
8889 getLog ().debug ("Cannot open browser" , e );
8990 }
@@ -101,6 +102,9 @@ private void onChange(Set<Path> modifiedFiles) {
101102 deployer .sendEnableCommand (deployer ::printResponse );
102103 }
103104 }
105+ if (deployer .sendReloadCommand (getAppURL (), deployer ::printResponse ) == CommandResult .ERROR ) {
106+ getLog ().warn ("Reload failed" );
107+ }
104108 }
105109
106110 private boolean compileSources () {
@@ -120,4 +124,9 @@ private boolean isSourceCode(Path path) {
120124 .resolve ("src/main" ).relativize (path );
121125 return CODE_CONTAINING_SRC_DIRS .stream ().anyMatch (relativePath ::startsWith );
122126 }
127+
128+ private String computeApplicationURL () {
129+ String httpUrl = payaraAminURL .replaceFirst (":\\ d+$" , ":" + payaraHttpPort );
130+ return "%s/%s" .formatted (httpUrl , project .getBuild ().getFinalName ());
131+ }
123132}
0 commit comments