TravaOpenJDK / trava-jdk-11-dcevm

dcevm-11 built on Travis
Apache License 2.0
403 stars 57 forks source link

Hot Reload doesn't work with Intellij setup #41

Closed strogiyotec closed 2 years ago

strogiyotec commented 3 years ago

Good day , I can't make it work with my Intellij project. Here is my setup Intellij IDEA version = 2020.3.2 Trava build = dcevm-11.0.10+5

Intellij project settings image

VM arguments are

-XX:HotswapAgent=external -javaagent:/usr/lib/jvm/hotswap-agent-1.4.1.jar=disablePlugin=Hibernate

I don't have any log errors. Here is the output and according to documentation it's exactly how it is supposed to look like(First line indicates that agent was loaded)

HOTSWAP AGENT: 15:41:35.831 INFO (org.hotswap.agent.HotswapAgent) - Loading Hotswap agent {1.4.1} - unlimited runtime class redefinition.
HOTSWAP AGENT: 15:41:36.234 INFO (org.hotswap.agent.config.PluginRegistry) - Discovered plugins: [JdkPlugin, Hotswapper, WatchResources, ClassInitPlugin, AnonymousClassPatch, Hibernate3JPA, Hibernate3, Spring, Jersey1, Jersey2, Jetty, Tomcat, ZK, Logback, Log4j2, MyFaces, Mojarra, Omnifaces, ELResolver, WildFlyELResolver, OsgiEquinox, Owb, Proxy, WebObjects, Weld, JBossModules, ResteasyRegistry, Deltaspike, GlassFish, Vaadin, Wicket, CxfJAXRS, FreeMarker, Undertow, MyBatis]

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.3.4.RELEASE)

HOTSWAP AGENT: 15:41:37.284 INFO (org.hotswap.agent.config.PluginRegistry) - Plugin 'org.hotswap.agent.plugin.spring.SpringPlugin' initialized in ClassLoader 'jdk.internal.loader.ClassLoaders$AppClassLoader@2c13da15'.
HOTSWAP AGENT: 15:41:37.287 INFO (org.hotswap.agent.plugin.spring.SpringPlugin) - Spring plugin initialized - Spring core version '5.2.9.RELEASE'
2021-03-24 15:41:37.387  INFO 12090 --- [           main] CoreApplication     : Starting 
2021-03-24 15:41:37.389  INFO 12090 --- [           main] CoreApplication     : The following profiles are active: localhost

I am trying to change controller methods but after I press ctrl+shift+f9 I don't see any changes . Also Reload classes after compilation in Intellij is set to Always. Do you have any idea what could be the problem ? Thanks in advance

zsalab commented 3 years ago

I have the same problem, IntelliJ does not do the auto rebuild even if you enable it on the Compiler settings. You can click on the build icon to force rebuild. You will see the result in the logs as DCEVM picks up the change.

strogiyotec commented 3 years ago

@zsalab hey , build button doesn't trigger reload, I don't see any logs and changes were not applied , maybe there is a compiler setting that I am missing , could you tell me which setting you are using ?

zsalab commented 3 years ago

I have written DCEVM introduction with examples for different IDEs, you can check it out, see the link below, if you wish to skip the context than you can find the link for the IntelliJ on the bottom. I hope it will help, if not please let me know I will try to help to figure out (than I can improve the docs)

https://zsalab.medium.com/extended-java-hotswap-capabilities-94685d172fcf

https://github.com/zsalab/dcevm-spring-boot/blob/main/IDEs/IntelliJ/README.md

skybber commented 3 years ago

Great article, thanks!

nomuna commented 3 years ago

@zsalab hey , build button doesn't trigger reload, I don't see any logs and changes were not applied , maybe there is a compiler setting that I am missing , could you tell me which setting you are using ?

Is it possible that you are running the application and not debugging it? If you want the hot swapping to function in run mode you have to set the flag autoHotswap to true in the file src/main/resources/hotswap-agent.properties.

skybber commented 3 years ago

Look at configuration of HotswapAgent, you will need extraClasspath along with autoHotswap properties.