Yes, with DukeScript you can avoid the need to reload and moreover thanks to the structural nature of the used language (Java) also avoid the loss of memory state during “reload”.
No Redeploys via Command Line
Let’s start by creating sample skeletal project from our Maven Archetypes and execute it:
$ mvn archetype:generate \ -DarchetypeGroupId=com.dukescript.archetype \ -DarchetypeArtifactId=knockout4j-archetype -DarchetypeVersion=0.11 \ # or more recent version when available -DgroupId=com.dukescript.test \ -DartifactId=no-redeploys \ -Dversion=1.0-SNAPSHOT $ cd no-redeploys $ mvn install $ cd client $ mvn exec:exec
Your application is running and you can play with it. For example change the Hello World message and see how it is changing throughout the page (more about the structure of the application in getting started tutorial). However we are not here to analyse the structure of the application, but to see the benefit of the re-deploys. Leave the application running and locate the DataModel.java file in your application. In the words method find the line that splits the Message String and change it to convert all characters to lowercase:
$ find src/ | grep DataModel.java src/main/java/com/dukescript/test/DataModel.java # the following command prints the line we want to change $ grep split src/main/java/com/dukescript/test/DataModel.java String words = message == null ? new String : message.split(" ", 6); # use your favorite editor here $ sed -i s/message[^=]*split/message.toLowerCase\(\).split/ src/main/java/com/dukescript/test/DataModel.java # verify the line is really changed $ grep split src/main/java/com/dukescript/test/DataModel.java String words = message == null ? new String : message.toLowerCase().split(" ", 6); # perform the re-deploy $ mvn process-classes
Now return back to your application and type a character into Hello World message field. This invokes the modified code and you can see that all words are now in lower case. If you want, you can now switch to upper case:
$ sed -i s/message[^=]*split/message.toUpperCase\(\).split/ src/main/java/com/dukescript/test/DataModel.java $ mvn process-classes
See the productivity boost!? No more re-deploys! Just change your code and immediately see the changes.
No Redeploys from an IDE
Open the client project in NetBeans 8.x. Press F6 to execute it. Play with the application as usual. Press Ctrl-O and to open the DataModel class. Change the line as in the above example. Press Ctrl-S to save the file and change something in the Hello World input field in your running application - the change is immediately visible.
No more re-deploys with DukeScript!