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.
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.
Well this is the solution that is working 100% as I expected. I came up with this after the answers of @erik-b and @jorn-horstmann 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:
Auto-reloading modules feature must be disabled, otherwise every time you execute the above Ant target Tomcat will reload Share and other web apps deployed. Additionally, 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:
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.