Alfresco / alfresco-sdk

The Alfresco In-Process SDK is based on Apache Maven, includes support for rapid and standard development, testing, packaging, versioning and release of your Alfresco integration and extension projects
Apache License 2.0
185 stars 113 forks source link

Hotswap share not working on 5.1.f with SDK 3.0 #451

Closed shazada closed 3 years ago

shazada commented 7 years ago

When using (haven't tried other versions)

5.1.g 5.1.f Refresh webscripts with goal `mvn alfresco:refresh-share` does refresh but the changes aren't visible. Steps to reproduce: 1. Create a share project 2. Change the sample webscript in src\main\resources\alfresco\web-extension\site-webscripts\com\example\pages\simple-page.get.js 3. For example remove the logo with id id: "DEMO_SIMPLE_LOGO" within the widget 4. run mvn alfresco:refresh-share 5. in the console you'll see that the webscripts are refreshed 6. Change isn't visilbe The resources are as wel in test-classes, but the extraClasspath property in **share-hotswap-agent.properties** isn't triggered. So the changes aren't available in the embedded tomcat :)
ohej commented 7 years ago

Hmm, with hotswap agent enabled and doing "mvn compile" (or a simple save in Eclipse or changing in IntelliJ) gives me a different result. Can you try doing "mvn compile" and see if that triggers it?

ohej commented 7 years ago

Sorry to clarify, in IntelliJ I run the "Make project" command to trigger the build, in Eclipse saving the file seems to trigger it

shazada commented 7 years ago

I'm using Eclipse and saving doesn't trigger it. In the Old SDK it dit trigger the refreshing.

I'll try mvn compile.

ohej commented 7 years ago

What kind of output are you seeing from hot swap agent when you save the file in Eclipse?

shazada commented 7 years ago

Nothing in the console :).

ohej commented 7 years ago

Hmm, did you disable the tracing? Unless you modified the hotswap-agent.properties file it should be VERY verbose, have you verified that hot swap agent is indeed active?

I output like this:

$ MAVEN_OPTS="-XXaltjvm=dcevm -javaagent:/Users/ohejlskov/hotswap-agent-1.0.jar -Xms256m -Xmx2G" mvn install alfrescrun
objc[9671]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.8.0_112.jdk/Contents/Home/bin/java (0x1055224c0) and /Library/Java/JavaVirtualMachines/jdk1.8.0_112.jdk/Contents/Home/jre/lib/libinstrument.dylib (0x1055ea4e0). One of the two will be used. Which one is undefined.
HOTSWAP AGENT: 14:51:58.314 INFO (org.hotswap.agent.HotswapAgent) - Loading Hotswap agent {1.0} - unlimited runtime class redefinition.
HOTSWAP AGENT: 14:51:58.862 INFO (org.hotswap.agent.config.PluginRegistry) - Discovered plugins: [Hotswapper, WatchResources, AnonymousClassPatch, ClassInitPlugin, Hibernate, Hibernate3JPA, Hibernate3, Spring, Jersey1, Jersey2, Jetty, Tomcat, ZK, Logback, Log4j2, MyFaces, Mojarra, Seam, ELResolver, WildFlyELResolver, OsgiEquinox, Proxy, WebObjects, Weld, JBossModules, ResteasyRegistry, Deltaspike, JavaBeans]
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
shazada commented 7 years ago

Oke, My run configuration in Eclipse is as follows: install alfresco:run with no extra maven params.

Output is this in the eclipse console:

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building my-share-project Share Jar Module - SDK 3 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] Downloading: https://artifacts.alfresco.com/nexus/content/groups/private/org/jvnet/staxex/stax-ex/maven-metadata.xml
[WARNING] Could not transfer metadata org.jvnet.staxex:stax-ex/maven-metadata.xml from/to alfresco-private-repository (https://artifacts.alfresco.com/nexus/content/groups/private): Access denied to https://artifacts.alfresco.com/nexus/content/groups/private/org/jvnet/staxex/stax-ex/maven-metadata.xml. Error code 401, Unauthorized
[WARNING] Failure to transfer org.jvnet.staxex:stax-ex/maven-metadata.xml from https://artifacts.alfresco.com/nexus/content/groups/private was cached in the local repository, resolution will not be reattempted until the update interval of alfresco-private-repository has elapsed or updates are forced. Original error: Could not transfer metadata org.jvnet.staxex:stax-ex/maven-metadata.xml from/to alfresco-private-repository (https://artifacts.alfresco.com/nexus/content/groups/private): Access denied to https://artifacts.alfresco.com/nexus/content/groups/private/org/jvnet/staxex/stax-ex/maven-metadata.xml. Error code 401, Unauthorized
[INFO] 
[INFO] --- maven-resources-plugin:3.0.1:resources (default-resources) @ my-share-project ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 13 resources
[INFO] 
[INFO] --- jrebel-maven-plugin:1.1.6:generate (generate-rebel-xml) @ my-share-project ---
[INFO] Processing com.acme.alfresco:my-share-project with packaging jar
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ my-share-project ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:3.0.1:testResources (default-testResources) @ my-share-project ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ my-share-project ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ my-share-project ---
[INFO] 
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ my-share-project ---
[INFO] Building jar: C:\Projecten\github\my-share-project\target\my-share-project-1.0-SNAPSHOT.jar
[INFO] 
[INFO] --- maven-assembly-plugin:2.6:single (build-amp-file) @ my-share-project ---
[INFO] Building amp: C:\Projecten\github\my-share-project\target\my-share-project-1.0-SNAPSHOT.amp
[INFO] 
[INFO] --- maven-install-plugin:2.4:install (default-install) @ my-share-project ---
[INFO] Installing C:\Projecten\github\my-share-project\target\my-share-project-1.0-SNAPSHOT.jar to D:\Program Files\apache-maven-3.0.4\repository\com\acme\alfresco\my-share-project\1.0-SNAPSHOT\my-share-project-1.0-SNAPSHOT.jar
[INFO] Installing C:\Projecten\github\my-share-project\pom.xml to D:\Program Files\apache-maven-3.0.4\repository\com\acme\alfresco\my-share-project\1.0-SNAPSHOT\my-share-project-1.0-SNAPSHOT.pom
[INFO] Installing C:\Projecten\github\my-share-project\target\my-share-project-1.0-SNAPSHOT.amp to D:\Program Files\apache-maven-3.0.4\repository\com\acme\alfresco\my-share-project\1.0-SNAPSHOT\my-share-project-1.0-SNAPSHOT.amp
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building my-share-project Share Jar Module - SDK 3 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- alfresco-maven-plugin:3.0.0:run (default-cli) @ my-share-project ---
[INFO] Configured Artifact: org.alfresco:share:5.1.f:war
[INFO] share-5.1.f.war already unpacked.
[INFO] Configured Artifact: com.acme.alfresco:my-share-project:1.0-SNAPSHOT:jar
[INFO] Copying my-share-project-1.0-SNAPSHOT.jar to C:\Projecten\github\my-share-project\target\share-war\WEB-INF\lib\my-share-project-1.0-SNAPSHOT.jar
[INFO] Copying Share log4j.properties to: C:\Projecten\github\my-share-project\target/share-war/WEB-INF/classes
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Tomcat Port overridden by property maven.tomcat.port
[INFO] Copying Share config custom to: C:\Projecten\github\my-share-project\target/share-war/WEB-INF/classes/alfresco/web-extension/
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO] Copying share-hotswap-agent.properties to C:\Projecten\github\my-share-project\target/share-war/WEB-INF/classes/
[INFO] Renamed C:\Projecten\github\my-share-project\target\test-classes\share-hotswap-agent.properties to C:\Projecten\github\my-share-project\target\share-war\WEB-INF\classes\hotswap-agent.properties
[INFO] Installing C:\Projecten\github\my-share-project\target\share.war to D:\Program Files\apache-maven-3.0.4\repository\com\acme\alfresco\my-share-project-share\1.0-SNAPSHOT\my-share-project-share-1.0-SNAPSHOT.war
[INFO] Starting Tomcat, fork = false
[INFO] <?xml version="1.0" encoding="UTF-8"?>
<webapp>
  <groupId>${project.groupId}</groupId>
  <artifactId>${project.artifactId}-share</artifactId>
  <version>${project.version}</version>
  <type>war</type>
  <asWebapp>true</asWebapp>
  <contextPath>/share</contextPath>
</webapp>
[INFO] Tomcat Port overridden by property maven.tomcat.port
[INFO] Running war on http://localhost:8081/
[INFO] Using existing Tomcat server configuration at C:\Projecten\github\my-share-project\target\tomcat
[INFO] create webapp with contextPath: 
[INFO] Deploying dependency wars
[INFO] Deploy warfile: D:\Program Files\apache-maven-3.0.4\repository\com\acme\alfresco\my-share-project-share\1.0-SNAPSHOT\my-share-project-share-1.0-SNAPSHOT.war to contextPath: /share
apr 11, 2017 4:13:47 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8081"]
apr 11, 2017 4:13:47 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Tomcat
apr 11, 2017 4:13:47 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.47
apr 11, 2017 4:13:56 PM org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
apr 11, 2017 4:13:56 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
2017-04-11 16:14:09,700  INFO  [config.packaging.ModulePackageManager] [localhost-startStop-1] Found 2 module package(s)
2017-04-11 16:14:09,702  INFO  [config.packaging.ModulePackageManager] [localhost-startStop-1] my-share-project Share Jar Module - SDK 3, 1.0-SNAPSHOT, Share JAR Module (to be included in the share.war) - SDK 3
my-share-project Share Jar Module - SDK 3, 1.0-SNAPSHOT, Share JAR Module (to be included in the share.war) - SDK 3

2017-04-11 16:14:10,608  INFO  [extensions.webscripts.TemplateProcessorRegistry] [localhost-startStop-1] Registered template processor freemarker for extension ftl
2017-04-11 16:14:10,611  INFO  [extensions.webscripts.ScriptProcessorRegistry] [localhost-startStop-1] Registered script processor javascript for extension js
2017-04-11 16:14:10,612  INFO  [extensions.webscripts.TemplateProcessorRegistry] [localhost-startStop-1] Registered template processor freemarker for extension ftl
2017-04-11 16:14:10,613  INFO  [extensions.webscripts.ScriptProcessorRegistry] [localhost-startStop-1] Registered script processor javascript for extension js
2017-04-11 16:14:15,438  INFO  [extensions.webscripts.DeclarativeRegistry] [localhost-startStop-1] Registered 388 Web Scripts (+0 failed), 406 URLs
2017-04-11 16:14:15,438  INFO  [extensions.webscripts.DeclarativeRegistry] [localhost-startStop-1] Registered 8 Package Description Documents (+0 failed) 
2017-04-11 16:14:15,438  INFO  [extensions.webscripts.DeclarativeRegistry] [localhost-startStop-1] Registered 0 Schema Description Documents (+0 failed) 
2017-04-11 16:14:15,562  INFO  [extensions.webscripts.AbstractRuntimeContainer] [localhost-startStop-1] Initialised Surf Container Web Script Container (in 4925.6494ms)
2017-04-11 16:14:15,568  INFO  [extensions.webscripts.TemplateProcessorRegistry] [localhost-startStop-1] Registered template processor freemarker for extension ftl
2017-04-11 16:14:15,569  INFO  [extensions.webscripts.ScriptProcessorRegistry] [localhost-startStop-1] Registered script processor javascript for extension js
apr 11, 2017 4:14:15 PM org.apache.catalina.core.ApplicationContext log
INFO: org.tuckey.web.filters.urlrewrite.UrlRewriteFilter INFO: loaded (conf ok)
apr 11, 2017 4:14:15 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring FrameworkServlet 'Spring Surf Dispatcher Servlet'
apr 11, 2017 4:14:15 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8081"]
shazada commented 7 years ago

Ooh i didn't know i needed an extra hotswap-agent :P. I've overlooked that part in the documentation probably.

shazada commented 7 years ago

I've double checked the documentation but couldn't find it anywhere :)

So when I add it explicity in my Maven JRE Configuration tab in Eclipse like this: -javaagent:C:\Users\tahir\OneDrive\Projecten\Alfresco\SDK\hotswap-agent-1.0.jar -Xms256m -Xmx2G

Then I get this output:

HOTSWAP AGENT: 16:22:19.754 INFO (org.hotswap.agent.HotswapAgent) - Loading Hotswap agent {1.0} - unlimited runtime class redefinition.
HOTSWAP AGENT: 16:22:20.304 INFO (org.hotswap.agent.config.PluginRegistry) - Discovered plugins: [Hotswapper, WatchResources, AnonymousClassPatch, ClassInitPlugin, Hibernate, Hibernate3JPA, Hibernate3, Spring, Jersey1, Jersey2, Jetty, Tomcat, ZK, Logback, Log4j2, MyFaces, Mojarra, Seam, ELResolver, WildFlyELResolver, OsgiEquinox, Proxy, WebObjects, Weld, JBossModules, ResteasyRegistry, Deltaspike, JavaBeans]
[INFO] Scanning for projects...  
shazada commented 7 years ago

Downloaded the hotswapagent here: https://github.com/HotswapProjects/HotswapAgent/releases

shazada commented 7 years ago

Oke with the above setting it kindof work.

Yes I see after saving the following output:

HOTSWAP AGENT: 16:34:37.267 DEBUG (org.hotswap.agent.watch.nio.TreeWatcherNIO) - Watch event 'ENTRY_MODIFY' on 'C:\Projecten\github\my-share-project\target\classes\META-INF\resources\my-share-project\js\tutorials\widgets\i18n\TemplateWidget.properties' --> classes\META-INF\resources\my-share-project\js\tutorials\widgets\i18n\TemplateWidget.properties
HOTSWAP AGENT: 16:34:37.273 DEBUG (org.hotswap.agent.watch.nio.TreeWatcherNIO) - Watch event 'ENTRY_MODIFY' on 'C:\Projecten\github\my-share-project\target\classes\META-INF\resources\my-share-project\js\tutorials\widgets\i18n\TemplateWidget.properties' --> classes\META-INF\resources\my-share-project\js\tutorials\widgets\i18n\TemplateWidget.properties
HOTSWAP AGENT: 16:34:37.274 DEBUG (org.hotswap.agent.watch.nio.TreeWatcherNIO) - Watch event 'ENTRY_MODIFY' on 'C:\Projecten\github\my-share-project\target\classes\META-INF\resources\my-share-project\js\tutorials\widgets\templates\TemplateWidget.html' --> classes\META-INF\resources\my-share-project\js\tutorials\widgets\templates\TemplateWidget.html
HOTSWAP AGENT: 16:34:37.280 DEBUG (org.hotswap.agent.watch.nio.TreeWatcherNIO) - Watch event 'ENTRY_MODIFY' on 'C:\Projecten\github\my-share-project\target\classes\META-INF\resources\my-share-project\js\tutorials\widgets\templates\TemplateWidget.html' --> classes\META-INF\resources\my-share-project\js\tutorials\widgets\templates\TemplateWidget.html
HOTSWAP AGENT: 16:34:37.280 DEBUG (org.hotswap.agent.watch.nio.TreeWatcherNIO) - Watch event 'ENTRY_MODIFY' on 'C:\Projecten\github\my-share-project\target\classes\META-INF\share-config-custom.xml' --> classes\META-INF\share-config-custom.xml
HOTSWAP AGENT: 16:34:37.293 DEBUG (org.hotswap.agent.watch.nio.TreeWatcherNIO) - Watch event 'ENTRY_MODIFY' on 'C:\Projecten\github\my-share-project\target\classes\META-INF\share-config-custom.xml' --> classes\META-INF\share-config-custom.xml
HOTSWAP AGENT: 16:34:37.294 DEBUG (org.hotswap.agent.watch.nio.TreeWatcherNIO) - Watch event 'ENTRY_MODIFY' on 'C:\Projecten\github\my-share-project\target\classes\alfresco\module\my-share-project\module.properties' --> classes\alfresco\module\my-share-project\module.properties
HOTSWAP AGENT: 16:34:37.299 DEBUG (org.hotswap.agent.watch.nio.TreeWatcherNIO) - Watch event 'ENTRY_MODIFY' on 'C:\Projecten\github\my-share-project\target\classes\alfresco\module\my-share-project\module.properties' --> classes\alfresco\module\my-share-project\module.properties
HOTSWAP AGENT: 16:34:37.300 DEBUG (org.hotswap.agent.watch.nio.TreeWatcherNIO) - Watch event 'ENTRY_MODIFY' on 'C:\Projecten\github\my-share-project\target\classes\alfresco\web-extension\messages\my-share-project.properties' --> classes\alfresco\web-extension\messages\my-share-project.properties
HOTSWAP AGENT: 16:34:37.300 DEBUG (org.hotswap.agent.watch.nio.TreeWatcherNIO) - Watch event 'ENTRY_MODIFY' on 'C:\Projecten\github\my-share-project\target\classes\alfresco\web-extension\messages\my-share-project.properties' --> classes\alfresco\web-extension\messages\my-share-project.properties
HOTSWAP AGENT: 16:34:37.301 DEBUG (org.hotswap.agent.watch.nio.TreeWatcherNIO) - Watch event 'ENTRY_MODIFY' on 'C:\Projecten\github\my-share-project\target\classes\alfresco\web-extension\my-share-project-slingshot-application-context.xml' --> classes\alfresco\web-extension\my-share-project-slingshot-application-context.xml
HOTSWAP AGENT: 16:34:37.302 DEBUG (org.hotswap.agent.watch.nio.TreeWatcherNIO) - Watch event 'ENTRY_MODIFY' on 'C:\Projecten\github\my-share-project\target\classes\alfresco\web-extension\my-share-project-slingshot-application-context.xml' --> classes\alfresco\web-extension\my-share-project-slingshot-application-context.xml
HOTSWAP AGENT: 16:34:37.302 DEBUG (org.hotswap.agent.watch.nio.TreeWatcherNIO) - Watch event 'ENTRY_MODIFY' on 'C:\Projecten\github\my-share-project\target\classes\alfresco\web-extension\site-data\extensions\my-share-project-example-widgets.xml' --> classes\alfresco\web-extension\site-data\extensions\my-share-project-example-widgets.xml
HOTSWAP AGENT: 16:34:37.303 DEBUG (org.hotswap.agent.watch.nio.TreeWatcherNIO) - Watch event 'ENTRY_MODIFY' on 'C:\Projecten\github\my-share-project\target\classes\alfresco\web-extension\site-data\extensions\my-share-project-example-widgets.xml' --> classes\alfresco\web-extension\site-data\extensions\my-share-project-example-widgets.xml
HOTSWAP AGENT: 16:34:37.304 DEBUG (org.hotswap.agent.watch.nio.TreeWatcherNIO) - Watch event 'ENTRY_MODIFY' on 'C:\Projecten\github\my-share-project\target\classes\alfresco\web-extension\site-webscripts\com\example\pages\simple-page.get.desc.xml' --> classes\alfresco\web-extension\site-webscripts\com\example\pages\simple-page.get.desc.xml
HOTSWAP AGENT: 16:34:37.304 DEBUG (org.hotswap.agent.watch.nio.TreeWatcherNIO) - Watch event 'ENTRY_MODIFY' on 'C:\Projecten\github\my-share-project\target\classes\alfresco\web-extension\site-webscripts\com\example\pages\simple-page.get.desc.xml' --> classes\alfresco\web-extension\site-webscripts\com\example\pages\simple-page.get.desc.xml
HOTSWAP AGENT: 16:34:37.309 DEBUG (org.hotswap.agent.watch.nio.TreeWatcherNIO) - Watch event 'ENTRY_MODIFY' on 'C:\Projecten\github\my-share-project\target\classes\alfresco\web-extension\site-webscripts\com\example\pages\simple-page.get.js' --> classes\alfresco\web-extension\site-webscripts\com\example\pages\simple-page.get.js
HOTSWAP AGENT: 16:34:37.310 DEBUG (org.hotswap.agent.watch.nio.TreeWatcherNIO) - Watch event 'ENTRY_MODIFY' on 'C:\Projecten\github\my-share-project\target\classes\alfresco\web-extension\site-webscripts\com\example\pages\simple-page.get.js' --> classes\alfresco\web-extension\site-webscripts\com\example\pages\simple-page.get.js
HOTSWAP AGENT: 16:34:37.311 DEBUG (org.hotswap.agent.watch.nio.TreeWatcherNIO) - Watch event 'ENTRY_MODIFY' on 'C:\Projecten\github\my-share-project\target\classes\alfresco\web-extension\site-webscripts\org\alfresco\README.md' --> classes\alfresco\web-extension\site-webscripts\org\alfresco\README.md
HOTSWAP AGENT: 16:34:37.311 DEBUG (org.hotswap.agent.watch.nio.TreeWatcherNIO) - Watch event 'ENTRY_MODIFY' on 'C:\Projecten\github\my-share-project\target\classes\alfresco\web-extension\site-webscripts\org\alfresco\README.md' --> classes\alfresco\web-extension\site-webscripts\org\alfresco\README.md
HOTSWAP AGENT: 16:34:37.320 DEBUG (org.hotswap.agent.watch.nio.TreeWatcherNIO) - Watch event 'ENTRY_MODIFY' on 'C:\Projecten\github\my-share-project\target\test-classes\share\log4j.properties' --> test-classes\share\log4j.properties
HOTSWAP AGENT: 16:34:37.321 DEBUG (org.hotswap.agent.watch.nio.TreeWatcherNIO) - Watch event 'ENTRY_MODIFY' on 'C:\Projecten\github\my-share-project\target\test-classes\share\log4j.properties' --> test-classes\share\log4j.properties
HOTSWAP AGENT: 16:34:37.322 DEBUG (org.hotswap.agent.watch.nio.TreeWatcherNIO) - Watch event 'ENTRY_CREATE' on 'C:\Projecten\github\my-share-project\target\test-classes\share-hotswap-agent.properties' --> test-classes\share-hotswap-agent.properties
HOTSWAP AGENT: 16:34:37.323 DEBUG (org.hotswap.agent.watch.nio.TreeWatcherNIO) - Watch event 'ENTRY_MODIFY' on 'C:\Projecten\github\my-share-project\target\test-classes\share-hotswap-agent.properties' --> test-classes\share-hotswap-agent.properties
HOTSWAP AGENT: 16:34:37.331 DEBUG (org.hotswap.agent.watch.nio.TreeWatcherNIO) - Watch event 'ENTRY_MODIFY' on 'C:\Projecten\github\my-share-project\target\test-classes' --> test-classes
HOTSWAP AGENT: 16:34:37.406 DEBUG (org.hotswap.agent.annotation.handler.WatchEventCommand) - Executing resource changed method refreshJsfResourceBundles on class org.hotswap.agent.plugin.jsf.MyFacesPlugin for event WatchFileEvent on path C:\Projecten\github\my-share-project\target\classes\alfresco\web-extension\messages\my-share-project.properties for event ENTRY_MODIFY
HOTSWAP AGENT: 16:34:37.406 DEBUG (org.hotswap.agent.annotation.handler.WatchEventCommand) - Executing resource changed method refreshJsfResourceBundles on class org.hotswap.agent.plugin.jsf.MyFacesPlugin for event WatchFileEvent on path C:\Projecten\github\my-share-project\target\test-classes\share-hotswap-agent.properties for event ENTRY_MODIFY
HOTSWAP AGENT: 16:34:37.406 DEBUG (org.hotswap.agent.annotation.handler.WatchEventCommand) - Executing resource changed method refreshJsfResourceBundles on class org.hotswap.agent.plugin.jsf.MyFacesPlugin for event WatchFileEvent on path C:\Projecten\github\my-share-project\target\classes\META-INF\resources\my-share-project\js\tutorials\widgets\i18n\TemplateWidget.properties for event ENTRY_MODIFY
HOTSWAP AGENT: 16:34:37.406 DEBUG (org.hotswap.agent.annotation.handler.WatchEventCommand) - Executing resource changed method refreshJsfResourceBundles on class org.hotswap.agent.plugin.jsf.MyFacesPlugin for event WatchFileEvent on path C:\Projecten\github\my-share-project\target\test-classes\share\log4j.properties for event ENTRY_MODIFY
HOTSWAP AGENT: 16:34:37.406 DEBUG (org.hotswap.agent.annotation.handler.WatchEventCommand) - Executing resource changed method refreshJsfResourceBundles on class org.hotswap.agent.plugin.jsf.MyFacesPlugin for event WatchFileEvent on path C:\Projecten\github\my-share-project\target\classes\META-INF\resources\my-share-project\js\tutorials\widgets\i18n\TemplateWidget.properties for event ENTRY_MODIFY
HOTSWAP AGENT: 16:34:37.407 DEBUG (org.hotswap.agent.annotation.handler.WatchEventCommand) - Executing resource changed method refreshJsfResourceBundles on class org.hotswap.agent.plugin.jsf.MyFacesPlugin for event WatchFileEvent on path C:\Projecten\github\my-share-project\target\classes\alfresco\module\my-share-project\module.properties for event ENTRY_MODIFY
HOTSWAP AGENT: 16:34:37.407 DEBUG (org.hotswap.agent.annotation.handler.WatchEventCommand) - Executing resource changed method refreshJsfResourceBundles on class org.hotswap.agent.plugin.jsf.MyFacesPlugin for event WatchFileEvent on path C:\Projecten\github\my-share-project\target\classes\alfresco\module\my-share-project\module.properties for event ENTRY_MODIFY
HOTSWAP AGENT: 16:34:37.407 DEBUG (org.hotswap.agent.annotation.handler.WatchEventCommand) - Executing resource changed method refreshJsfResourceBundles on class org.hotswap.agent.plugin.jsf.MyFacesPlugin for event WatchFileEvent on path C:\Projecten\github\my-share-project\target\test-classes\share-hotswap-agent.properties for event ENTRY_CREATE
HOTSWAP AGENT: 16:34:37.408 DEBUG (org.hotswap.agent.annotation.handler.WatchEventCommand) - Executing resource changed method refreshJsfResourceBundles on class org.hotswap.agent.plugin.jsf.MyFacesPlugin for event WatchFileEvent on path C:\Projecten\github\my-share-project\target\classes\alfresco\web-extension\messages\my-share-project.properties for event ENTRY_MODIFY
HOTSWAP AGENT: 16:34:37.408 DEBUG (org.hotswap.agent.annotation.handler.WatchEventCommand) - Executing resource changed method refreshJsfResourceBundles on class org.hotswap.agent.plugin.jsf.MyFacesPlugin for event WatchFileEvent on path C:\Projecten\github\my-share-project\target\test-classes\share\log4j.properties for event ENTRY_MODIFY
HOTSWAP AGENT: 16:34:37.607 DEBUG (org.hotswap.agent.command.impl.SchedulerImpl) - Executing org.hotswap.agent.plugin.jsf.MyFacesPlugin$1@6b70be8b
HOTSWAP AGENT: 16:34:37.607 DEBUG (org.hotswap.agent.plugin.jsf.MyFacesPlugin) - Refreshing JSF resource bundles.

So I need to run mvn alfresco:refresh-share Then I get:

2017-04-11 16:35:36,146  INFO  [extensions.webscripts.DeclarativeRegistry] [http-bio-8081-exec-11] Registered 388 Web Scripts (+0 failed), 406 URLs
2017-04-11 16:35:36,147  INFO  [extensions.webscripts.DeclarativeRegistry] [http-bio-8081-exec-11] Registered 8 Package Description Documents (+0 failed) 
2017-04-11 16:35:36,147  INFO  [extensions.webscripts.DeclarativeRegistry] [http-bio-8081-exec-11] Registered 0 Schema Description Documents (+0 failed) 
2017-04-11 16:35:36,272  INFO  [extensions.webscripts.AbstractRuntimeContainer] [http-bio-8081-exec-11] Initialised Surf Container Web Script Container (in 6537.025ms)

And then the change is visible.

Is this okay?

ohej commented 7 years ago

This is okay, however I'm not sure what differences we have in our environment, my last test I did not have to invoke alfresco:refresh-share to make the changes appear, can you send some specs on your environment? (OS, Mvn, java etc) Then I'll try and reproduce the setup.

I did test this in Windows 10, JDK8, Maven 3.3.9, Ubuntu 16.04, JDK8, Maven 3.3.9, OSX 10.12, JDK8, Maven 3.3.9 and got consistent results so I am wondering a little ;)

shazada commented 7 years ago

Sorry forgot to reply on this.

I've got Windows 10 with Eclipse Neon.2 Release (4.6.2). Embedded Maven 3.3.9 running in Eclipse & JDK 8. External Maven 3.3.9 doesn't work as well.

Seems the only way workable is by invoking alfresco:refresh-share

touchvignesh commented 7 years ago

+1 I do have same issue. Everytime I need to run refresh-repo or refresh-share goal to get the changes reflected

touchvignesh commented 7 years ago

Also hotswap doesn't work for changes to .java files even after doing alfresco:refresh-repo. I use enterprise 5.0.3.5

tom-vandepoele commented 7 years ago

Did you install the DCEVM Java patch as altjvm? see http://hotswapagent.org/mydoc_quickstart.html

Hotswap agent requires a change to the JVM you use, if you haven't patched the JVM and just include the javaagent it won't work.

touchvignesh commented 7 years ago

Thank you @tom-vandepoele I missed that and could'nt see any reference on how to do it. Its explained in hotswap agent docs. Its works now !

gjongerh commented 7 years ago

I had troubles with hotswap and SDK3.0 and a platvorm jar with share jar embedded mvn3.3.9 java 1.8.0_121

with the default client-debug false, mvn alfresco:refresh-share is needed with client-debug true hotswap is working without the refresh

shazada commented 7 years ago

I've confirmed by Patching the JVM + adding the agent + altJVM to Eclipse hotswap is working.

Would be 'nice' if this gets a permanent Bold Paragraph in the 3.0 SDK, cause this is clearly different than the previouw SDK. And Also nice for 'newcomers' to know directly.

Great work!

shazada commented 7 years ago

Still an issue after applying JVM Patch. should I post it here or new ticket? now just for info: Refreshing share webscripts (ftls') doesn't work. Still need to do alfresco:refresh. Does it work for others?

krutik-jayswal commented 7 years ago

No Refreshing share webscript is not working.Facing issues in client side resources as well.

alucas commented 6 years ago

Any update ? Hotswap is still not working for webscript ressources. I need to reload Share every time I want to make a change. (js, css, properties, ...)

I tried to execute many commands (i.e. refresh-share, ...), nothing seem to be working.

Windows 10 JDK 1.8.0_181 DCEVM as Alt JVM for 8u181 build 2 Hotswap agent 1.3.0 IntelliJ IDEA 2018.1 Alfresco SDK 3.0.1 - maven archetype allinone Alfresco 5.2.3

krutik-jayswal commented 6 years ago

Use below url for clearing cache in alfresco share.It will reload resources.

http://localhost:8081/share/page/caches/report?clear=true

krutik-jayswal commented 6 years ago

Regarding share webscript ,It was working by adding below configuration inside share-config-custom.xml

&lt;config evaluator=&quot;string-compare&quot; condition=&quot;WebFramework&quot;&gt;
       &lt;web-framework&gt;
           &lt;autowire&gt;
               &lt;mode&gt;development&lt;/mode&gt;
           &lt;/autowire&gt;
       &lt;/web-framework&gt;
&lt;/config&gt;
alucas commented 6 years ago

Thx,

I replaced all occurences of the WebFramework config with your exemple. But that still doesn't work.

alucas commented 6 years ago

It was a problem with HotSwap 1.3 (and 1.2), I rolled back to 1.0 and it now work.