DPascalBernard / maven-alfresco-archetypes

Automatically exported from code.google.com/p/maven-alfresco-archetypes
0 stars 0 forks source link

Enable RAD by providing hot classes reload features #123

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
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 reported on code.google.com by gabriele...@alfresco.com on 10 Jun 2013 at 9:37

GoogleCodeExporter commented 9 years ago
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.

Original comment by pmo...@gmail.com on 11 Jun 2013 at 4:01

GoogleCodeExporter commented 9 years ago
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.

Original comment by gethin.j...@alfresco.com on 14 Jun 2013 at 8:09

GoogleCodeExporter commented 9 years ago

Original comment by colum...@gmail.com on 21 Jun 2013 at 11:14

GoogleCodeExporter commented 9 years ago

Original comment by colum...@gmail.com on 21 Jun 2013 at 11:15

GoogleCodeExporter commented 9 years ago
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"

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

      <plugins>
        <plugin>
          <groupId>org.zeroturnaround</groupId>
          <artifactId>jrebel-maven-plugin</artifactId>
          <version>1.1.5</version>
          <executions>
            <execution>
              <id>generate-rebel-xml</id>
              <phase>prepare-package</phase>
              <goals>
                <goal>generate</goal>
              </goals>
            </execution>
          </executions>
          <configuration>
            <packaging>war</packaging>
          </configuration>
        </plugin>
      </plugins>

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.

Original comment by mauri...@session.it on 6 Sep 2013 at 2:14

GoogleCodeExporter commented 9 years ago
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 :)

Original comment by bwav...@ziaconsulting.com on 6 Sep 2013 at 7:19

GoogleCodeExporter commented 9 years ago
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.

Original comment by bwav...@ziaconsulting.com on 7 Sep 2013 at 8:27

GoogleCodeExporter commented 9 years ago
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.

Original comment by maurizio...@alfresco.com on 9 Sep 2013 at 9:27

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r721.

Original comment by colum...@gmail.com on 5 Nov 2013 at 12:02

GoogleCodeExporter commented 9 years ago
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.

Original comment by gabriele...@alfresco.com on 5 Nov 2013 at 12:03