cancel
Showing results for 
Search instead for 
Did you mean: 

Hotswap hot reloading (javascript, freemarker files, ...)

ssciacca
Confirmed Champ
Confirmed Champ

I have a test project in Eclipse generated with maven archetype (allinone option).

I followed some tutorial on webscript in alfresco platform.

The example work fine but unfortunately the hot reloading ( configuration) of freemarker template or javascripts file does not work.

Hot reload of regular java class, also work fine, but hot reload of other resource does not work.

I can see (in the console) the hotswap message:

message Watch event 'ENTRY_MODIFY'

but when I try to test non change I do not see any changes.

For every small change (except java changes), I am forced to perform the whole procedure

clean install -DskipTests = true alfresco: run

I would appreciate your suggestions to solve the problem before starting with a serious development project.

Thank you for your help!

Best regards.

1 ACCEPTED ANSWER

ssciacca
Confirmed Champ
Confirmed Champ

I #solved the problem!. Follow the solution (for others with the same problem).

1. I followed Using HotSwapAgent | Alfresco Documentation 

2. Setup a new AllInOne project whit eclipse 

3. Check patch the JVM whith DCEVM (Quick Start | HotswapAgent ) but is ok 

4. Setup in Eclipse a new Maven Build "Run Configuration" whith goal

clean package -DskipTests=true alfresco:run

VM arguments:

-Xms256m -Xmx2G -javaagent:[PATH_TO_HOTSWAP_AGENT]/hotswap-agent-1.0.jar -XXaltjvm=dcevm

In previous configuration I had used "hotswap-agent-core-1.3.0.jar" because the "hotswap-agent-1.3.0.jar" library did'nt work (a handful of exceptions after launch). I this case Alfresco doc. suggests to use 1.0 version of agent.  

I think this was the main problem!

5. Create a new configuration file named "hotswap-agent.properties" in the folder $PLATFORM_PROJECT_FOLDER/src/main/resource whith only the following line

autoHotswap=true

6. Run the Maven Build (prepared before: step 4)

7. The All-In-One project contains an HelloWorld Web Script implemented in Java and JS. Point the browser to http://localhost:8080/alfresco/s/sample/helloworld and we can see messages from Java and from JS.

Now I can edit and hot-reload:  Java class (HelloWorldWebScript), FreeMarker file (helloworld.get.html.ftl), Javascript file (helloworld.get.js).

When I save on eclipse the hot-reload happens immediately and I can see the changes on the browser !!

Thank you to Krutik for help.

 

View answer in original post

11 REPLIES 11

Thats's great....

Adding further information for future reference....

In SDK 2.2.0 alfresco was using spring loaded for hot swap....(Rapid Application Development in Eclipse (Hot reloading) | Alfresco Documentation )

In SDK 3.0 , (which is mentioned above) is using hot swap agent for hot reloading...(Using HotSwapAgent | Alfresco Documentation )

Hey

Thank you for sharing the solution. I was also finding the solution and got here. Smiley Happy