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
184 stars 113 forks source link

Enable RAD by providing hot classes reload features #123

Closed mindthegab closed 10 years ago

mindthegab commented 10 years ago

From gabriele...@alfresco.com on June 10, 2013 17:37:50

Even with WAR packaging optimization, the development cycle is not uber-fast.

As Jrebel is proprietary, we need an open approach to reload classes / webapps during development.

An option could be to do it at Alfresco level using Spring Loaded https://github.com/SpringSource/spring-loaded .

Original issue: http://code.google.com/p/maven-alfresco-archetypes/issues/detail?id=123

mindthegab commented 10 years ago

From pmo...@gmail.com on June 10, 2013 21:01:30

I'm not sure if solutions like spring-loaded will work very well, given Alfresco's somewhat complex use of classloaders (e.g. for Web Script descriptor detection).

A potentially better approach would be to integrate with others who've tackled this specific problem head-on e.g. https://github.com/lfridael/dynamic-extensions-for-alfresco .

mindthegab commented 10 years ago

From gethin.j...@alfresco.com on June 14, 2013 01:09:58

This is a great idea. Firstly, Laurens' work on dynamic-extensions-for-alfresco (OSGI) is quite different from this requirement. JRebel/Spring-loaded can be used in a non-invasive manner during development with no impact on a production environment.

I use JRebel with Alfresco, (you can get a free licence if you work on an open source project like Alfresco). JRebel has plugins to attempt to reload Spring beans when they change. By the way, a while ago there was some interest in a JRebel plugin for Alfresco.

I agree that any class reloading solution can have issues with bean reloading / classloaders - it really depends what you are using it for. It's no "silver bullet" but if you are changing something like a method body in an implementation then it could rapidly improve the development cycle.

I've haven't used spring-loaded but have it on my list to try out. It's certainly worth exploring the options.

mindthegab commented 10 years ago

From colum...@gmail.com on June 21, 2013 04:14:53

Owner: colum...@gmail.com
Labels: Milestone-Release-sdk-1.1.0

mindthegab commented 10 years ago

From colum...@gmail.com on June 21, 2013 04:15:14

Labels: -Type-Defect Type-Enhancement

mindthegab commented 10 years ago

From mauri...@session.it on September 06, 2013 07:14:06

I just tried to

  1. Install (and activate) JRebel plugin on IDEA - http://zeroturnaround.com/software/jrebel/download/using-jrebel-with-intellij/ 2. Add the following env properties

export JREBEL_JAR="$HOME/Dropbox/mau/opt/jrebel-5.3.2/jrebel.jar" export MAVEN_OPTS="-Xms256m -Xmx2G -XX:PermSize=300m -javaagent:$JREBEL_JAR" export JAVA_OPTS="$JAVA_OPTS -Xbootclasspath/a:$JREBEL_JAR"

  1. Add the following snippet on one of my existing amp-archetype projects:

    org.zeroturnaround jrebel-maven-plugin 1.1.5 generate-rebel-xml prepare-package generate war

And guess what, it just works!

  1. mvn package -Pamp-to-war #Jetty will start
  2. Change some Java code
  3. [On a separate terminal, same project folder] mvn compile

I'm not sure that this code should be included in any of our pom.xml files (maybe we could provide a jrebel profile) since the installation process would still need some manual operations (installing/activating JRebel)

On the other hand, considering how simple it can be configured, I think that a blogpost would draw attention and help a lot of teams to speedup their development cycles.

mindthegab commented 10 years ago

From bwav...@ziaconsulting.com on September 06, 2013 12:19:24

FWIW, you can install the JRebel plugin from IntelliJ directly, just search for it in the plugins page and install. It will take care of the environment setup for you. You can add the jrebel stuff via maven as you have or you can use the IDE by right clicking on the projects and adding the jrebel nature... I haven't done it in a few months so don't remember the exact terminology, but it's all point and click. Very easy :)

mindthegab commented 10 years ago

From bwav...@ziaconsulting.com on September 07, 2013 13:27:59

I have not tried [ http://ssw.jku.at/dcevm/ dcevm], but it looks interesting. They appear to have issues with Java 1.6_26, but prior versions are compatible. Unclear if future versions are supported. It's possible that this is being incorporated into the official HotSwap builds of Java 1.8. They don't appear to have support for spring bean definition changes at runtime, might work with annotations, but probably not with XML based config like we use. They do seem to support quite a bit more than hotswap at the java level, so might be interesting to folks.

mindthegab commented 10 years ago

From maurizio...@alfresco.com on September 09, 2013 02:27:38

Thanks a lot Bindu for the feedback.

Re. JRebel, I did install the IntelliJ plugin and it was very smooth; the need for a jrebel-maven-plugin is for automatically generating the rebel.xml definition file (and to put it into the classpath)

Re. dcevm, I didn't know it and looks extremely interesting; I agree that we should be testing it to see how it behaves when Spring definitions change.

mindthegab commented 10 years ago

From colum...@gmail.com on November 04, 2013 16:02:00

This issue was closed by revision r721 .

Status: Fixed

mindthegab commented 10 years ago

From gabriele...@alfresco.com on November 04, 2013 16:03:38

I have added default JRebel configuration to the AMP archetype, testing now on the all in one, activated with the -Prad profile.

Also in relation to issue #150 , in the -Prad profile there's also a JUnit remote runner based on https://github.com/Tradeshift/junit-remote .