cancel
Showing results for 
Search instead for 
Did you mean: 

How to speed up Share development

alejandrogarcia
Champ in-the-making
Champ in-the-making
Hi all,

I'm developing and performing some customization on Share. My IDE is Eclipse Juno and workspace is made up of the next elements:

* alfresco web project
* extensions Java project
* share web project

Both alfresco and share web projects are deployed in separate Tomcat instances, this way I can slightly speed up my development tasks by restarting only the Tomcat instance where Share is deployed.

My extensions Java project has the same structure as the Eclipse project proposed by Alfresco. Y the provided Ant tasks for compiling, compressing JavaScript files, packaging and deploying the resultant JAR file in Tomcat.

I'm developing some new JavaScript client-side widgets, which means every time I make a change I have to stop Tomcat, launch Ant build script and start again so as I have to do it very often, you can guess what a pain it is becoming. I was just wondering if there exist any way to speed up development tasks on Share. How do Alfresco developers team do it? What kind of environment do they set up?

I was thinking about creating a new Ant target which hot deploys extension project's content into deployed Share web project, taking into account paths of course; that mechanism must allow the reverse operation by the way. Would that be viable? The idea would be to have a similar deploy mechanism as when you  develop regular web projects: when you make any change you just push the "Publish" button and the changes are populated into the server.

I would like to know some tips and ideas, specifically from Alfresco developers team if possible.

Thanks in advance.

PS: I have already read  https://forums.alfresco.com/en/viewtopic.php?f=47&t=44850 and https://forums.alfresco.com/en/viewtopic.php?f=48&t=18749.
1 REPLY 1

alejandrogarcia
Champ in-the-making
Champ in-the-making
Well this is the solution that is working 100% as I expected. I came up with this after some answer I had to my question in Stackoverflow (http://stackoverflow.com/questions/14280186/how-to-speed-up-alfresco-share-development) and taking into account some posts I have read.

So basically I have the next Ant target which hot deploys the content of my Share extensions Java project:

    <!–
        Hot copy individual files into appropriate deployment folder (e.g. $TOMCAT_HOME/webapps/share)
    –>
    <target name="hotdeploy-tomcat-share" depends="clean, prepare, build-jar" description="Hot copy individual files into appropriate deployment folder (e.g. $TOMCAT_HOME/webapps/share)">
       <echo message="Generating and deploying JAR file with custom configuration files" />
        <jar destfile="${dist.dir}/${jar.name}">
           <!– Only including configuration XML files such as share-config-custom.xml –>
           <fileset dir="${build.jar.dir}" includes="**/META-INF/*.xml" />
        </jar>
        <copy todir="${tomcat.share.deployment.path}/WEB-INF/lib">
            <fileset file="${dist.dir}/${jar.name}" />
        </copy>
       
        <echo message="Hot deploying Share files" />
        <copy todir="${tomcat.share.deployment.path}/WEB-INF/classes" includeEmptyDirs="false">
            <fileset dir="${build.jar.dir}">
                <patternset refid="hotdeploy-tomcat-patternset" />
            </fileset>
        </copy>
    </target>

I believe it is also possible to hot deploy in the $TOMCAT_HOME/shared/ directory but I haven't tried it out yet.

The Java project I'm using for developing my extensions is this model project: http://code.google.com/p/share-extras/wiki/SampleProject. There is the full build script with the other targets required.

I'm also using this in my share-config-custom.xml:

       <!– Global config section –>
       <config replace="true">
          <flags>
             <!–
                Developer debugging setting to turn on DEBUG mode for client scripts in the browser
             –>
             <client-debug>true</client-debug>
   
             <!–
                LOGGING can always be toggled at runtime when in DEBUG mode (Ctrl, Ctrl, Shift, Shift).
                This flag automatically activates logging on page load.
             –>
             <client-debug-autologging>false</client-debug-autologging>
          </flags>
       </config>
      
       <config evaluator="string-compare" condition="WebFramework">
          <web-framework>
             <!– SpringSurf Autowire Runtime Settings –>
             <!–
                  Developers can set mode to 'development' to disable; SpringSurf caches,
                  FreeMarker template caching and Rhino JavaScript compilation.
             –>
             <autowire>
                <!– Pick the mode: "production" or "development" –>
                <mode>development</mode>
             </autowire>
   
             <!– Allows extension modules with <auto-deploy> set to true to be automatically deployed –>
             <module-deployment>
                <mode>manual</mode>
                <enable-auto-deploy-modules>true</enable-auto-deploy-modules>
             </module-deployment>
          </web-framework>
       </config>

The last XML snippet avoids to refresh webscripts after any change performed on an FTL page, for example.

I have also performed some tests with JRebel but after my experience I would say it doesn't helps a lot in Share development.

There is also interesting stuff in the next articles:

http://blogs.alfresco.com/wp/kevinr/2010/04/07/developer-tips-for-alfresco-share-33/
http://techblog.zabuchy.net/2012/debugging-javascript-in-alfresco/

Hope it helps others.