spring-projects / spring-loaded

Java agent that enables class reloading in a running JVM
Apache License 2.0
2.72k stars 515 forks source link

Spring-loaded + intellij 12 + tomcat7 configuration #28

Open adrianprecub opened 10 years ago

adrianprecub commented 10 years ago

Hello,

I want to deploy a simple war which uses spring mvc. What i did is i was able to start tomcat from intellij in debug mode, and the whole thing starts ok. When i make a call from the UI to the backend i can stop at my breakpoints and do hot code replace as usual(not adding methods or changing signatures).

Then i wanted to add spring-loaded so i added the vm option in intellij definition of tomcat. But when i add a new method or change the signature of a method, the class isn't reloaded like it should be. Maybe i'm missing some configuration?

Can someone help with a configuration for intellij + tomcat or eclipse + tomcat?

Thanks

liamchristopher commented 10 years ago

I just got something similar working, but am working through segfaults.

I'm using apache buildr for my build system, and this needed a little bit of massaging.

1) Tomcat: in setenv.sh, set your CATALINA_OPTS to include the springloaded.jar as a javaagent. 2) In context.xml (or your app.xml), add allowLinking="true" and override="true" in your 3) Build a war, explode it in the webapps folder, in the proper app location. 4) Remove WEB-INF/classes/com 5) Symlink your build path com/ folder (where eclipse targets its auto-build, mine is "target/classes/com" back to the WEB-INF/classes/ folder. 6) Start tomcat.

Now eclipse will compile changes and they will got directly to the app root. I don't use J2EE or the publish options, so that might need a little less work to get going.

Hope that helps!