First Maven Alfresco baby wails

Some random note, mostly to myself, to remember, in some dark Maven time, how cool this technology is and that sometimes, at a certain point sure, you CAN have success stories with it.

For now, as I anticipated I’m just playing around with Alfresco core modules, to see how they fit with Maven and how tough can it be to port the full suite.
And you know what guys, on Friday, in just 4 hours I was able to have the core AND webscript framework completely building and tested with Maven (98% success rate).

I mean, it’s just a beginning, but considering that Webscripts are meant/designed to be deployed and integrated also outside of Alfresco, well, you understand the power of having only to add few dependency lines.

I’ll just drop the raw log of my operations, to give you a raw idea what can take for the m10n of an Ant project and how easy it can be if the source project is well maintained and tested.

Alfresco core mavenization (m10n):

  1. Checkout the core
  2. Refactor source tree (source/java –> src/main/java) and test tree (search with Eclipse for *Test.java AND Test*.java and refactor them to src/test/java)
  3. Refactor resources (find them in source –> src/main/resources) and test resources  (find them in source –> src/test/resources)
  4. Create pom via m2eclipse by adding Maven nature
  5. Add dependencies (analyze .classpath file as first step, then cycles of  ‘mvn compile’ and fix)
  6. TIP: Use mvnrepository.com  or even better if you m2eclipse is configured with a proper Nexus/Maven classes index you can directly search deps clicking on the red underline of the compilation error from Eclipse
  7. Install missing/uncertain dependencies on local repo:
    cd alfresco/workspace/alfresco-head/projects/3rd-party/lib/
    mvn install:install-file -Dfile=jta.jar -DgroupId=javax.transaction -DartifactId=jta -Dversion=1.0.1b -Dpackaging=jar
    mvn install:install-file -Dfile=jug-lgpl-2.0.0.jar -DgroupId=jug -DartifactId=jug-lgpl -Dversion=2.0.0 -Dpackaging=jar
    mvn install:install-file -Dfile=ibatis-2.3.4.726-patched -DgroupId=com.ibatis -DartifactId=ibatis  -Dversion=2.3.4.726-patched -Dpackaging=jar
  8. Add target Java 1.5 in Eclipse project and in Maven:
    <plugin>
    <artifactId>maven-compiler-plugin</artifactId>
    <configuration>
    <source>1.5</source>
    <target>1.5</target>
    </configuration>
    </plugin>   
  9. Change line 47 in BaseTest.java
    // FIXME: Refactor this to take resource from classpath
    this.resourcesDir = System.getProperty("user.dir") + File.separator + "target" +
    File.separator + "test-classes" + File.separator;

Results:

Failed tests:
testJarSource(org.alfresco.config.xml.XMLConfigServiceTest)
Tests run: 54, Failures: 1, Errors: 0, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 minute 2    6 seconds
[INFO] Finished at: Fri May 22 20:32:39 CEST 2009
[INFO] Final Memory: 8M/22M
[INFO] ------------------------------------------------------------------------

Well pretty cool if you consider only a couple of hours of work, 54 tests out of 55 working again 😉
That’s refactoring yeah!

Webscript Framework mavenization (m10n):

Pretty much the same steps, some dependency to deploy but basically the same trick.

Nice to note, under modules coupling POV, that the only intra-Alfresco dependency of the Webscript Framework is the Core, so that in another couple of hours I was able to run a

mvn clean install

on the Webscript frameowork project, with the following result:
Failed tests:
testRemoteStore(org.alfresco.web.scripts.TestRemoteStore)
testRemoteClient(org.alfresco.connector.TestRemoteClient)
Tests run: 16, Failures: 2, Errors: 0, Skipped: 0
[ERROR] There are test failures.
Please refer to /Users/mindthegab/Dev/alfresco/workspace/WebScript Framework/target/surefire-reports for the individual test results.
[INFO] [jar:jar]
[INFO] Building jar: /Users/mindthegab/Dev/alfresco/workspace/WebScript Framework/target/alfresco-webscript-framework-3.2.0-SNAPSHOT.jar
[INFO] [install:install]
[INFO] Installing /Users/mindthegab/Dev/alfresco/workspace/WebScript Framework/target/alfresco-webscript-framework-3.2.0-SNAPSHOT.jar to /Users/mindthegab/.m2/repository/org/alfresco/alfresco-webscript-framework/3.2.0-SNAPSHOT/alfresco-webscript-framework-3.2.0-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 14 seconds

Ok needs refinement, and a proof of concept of integration in some webapp, but I feel already like all the “glue” power of Maven can be an additional enabler to such a feature-ful platform like Alfresco.
Suggest to stay tunes as I’ll definitely post more on this 🙂

The infinite tail of TODO

How come writing is always the last thing?
Before it was blogging, now fashion says we must micro-blog, and we even don’t have time to spend a few words on what we do. Effective as business, but blogging gave us a bit of writers pride, isn’t it? But it goes much earlier than that…the vast majority of software projects is developed almost until the end without any piece of seriously meaningful documentation.

Ok, ok, stop!

I was just finding lame philosophical excuses for not having blogged anything in this period of my life, such dense of changes in many aspects of my life and career. And this blog post keep staying in the infinite backlog of my TODOs.

May you live in interesting times

seems to run a famous Chinese or supposed to be Chinese curse, which I actually heard for the first at the Alfresco Rome’s meetup during my new CTO – John Newton – presentation, but that reflects the current status of my life, career and more in general world there days. Read more The infinite tail of TODO

Geek and Vain

It’s probably my first real recognition in open source matters. More soon will come, as I’m really putting my heart in the cause.
It was a nice surprise in fact to get to see my big face on Alfresco’s wiki home page, having been nominated January’s contributor of the month for the work on Alfresco and the Maven Archetypes.

Even if, I guess, the photo I sent the Alfresco guys reflects my vain nature 😉

Good stuff, especially as I’m trying to release the 3.0 version of the archetypes in a matter of days.  Stay posted on 3.0.0 branch and on Sourcesense‘s repo. And why not contribute? 🙂

God bless Open Source

Yes, it’s just yet another success story.

But still worth mentioning isn’t it? Especially when it happens right to you and right in one of the toughest period of my entire career.

So to keep it short: I’m working together with Marijn on some fully fledged complex Alfresco workflow, working on 3.0 but still on the “old” Alfresco web client (now renamed to Repository Explorer ).
Apart from Alfresco a bit odd JBPM Javascript implementation, we could get quite close to the fully working solution, but now that users are a bit struggling with the usability of the web client (and some lack of training) we are a bit delayed and trying to prioritize some issues.

One big requirement that has been left out was the possibility of displaying the task history of a workflow on the document details page. To be clear, Alfresco allows showing documents associated to a workflow, but the reverse association is not displayed and a document has no means of showing the task history that a specific document has undergone to.

About to drop this requirement, while googling around I came across this genius post, in which Marc de Kwant describes and shares the code of exactly this feature. Ok, I understand it’s a quite obvious requirement, especially in enterprise controlled documents contexts, but I mean, look at the picture, it’s exactly what I needed 😉Alfresco Task History Panel

That is extremely cool, and will allow to implement the feature in a matter of minutes.

Makes me wanna contribute to the project, just to give all my kudos to his great work (still have to try it actually, but appreciate the effort 😉 ).

The code is hosted here and if I look better at some comments on the blog post , seems that the gap of poor packaging of this feature (just a bunch of files dropped there) can be easily bridged with another success story, a one shot execution of my Maven AMP archetype. Guess it can make a really nice Forge contribution as such. Anyone interested to try it out?

I especially love when open source achievements come together in a product, which is typically more than double valued than the original addendums. That’s why I probably will always like, enjoy, be interested in being an open source integration pioneer.

SURF-ing Alfresco on the snow

I guess the title may sound a little odd, but actually leaving the coldest Dutch winter in ages (peaks around -20° degrees and nice snowy lanscapes especially in the Southern Holland) I was kinda hopeful that Munich could bring some joy to this Italian emigrant. But no joy for the foolish: already during landing I was announced a -12° not-so-warm welcome by the city where the Alfresco SURF Code Camp (held by Optaros) was held today.Luckily today, also thanks to the nice venue in a snowy park, but especially due to the presence of his Alfresco majesty Jeff Potts as main speaker, I could really get a feeling of what Alfresco SURF & SHARE are built upon, how they can be used and exploited to create rich user experiences based on emerging(ed) technologies like JSON, Atom and CMIS.

Exciting new perspectives in terms of architectural distribution and ease of UI development can open using SURF and the ReST approach as opposed to the old monolithic JSF Web client (now called Repository Explorer) customization.

And that was basically all what this very interesting Munich SURF Bootcamp was about.
Jeff Potts and the Optaros guys, which have supported Alfresco in the development of certain components of SHARE, organized this free one day workshop (same as in Chicago) covering both architectural and pretty technical aspects around this new way of developing frontends against an Alfresco repo with interesting walktroughs down to the code (nice idea here and fast working to deliver with pre-built VirtualBox/VMWare virtual machines).
What follows is a high level skecth of discussions and findings of the workshop while find my personal considerations at the bottom of the post (many thanks and all credits to Optaros and Jeff Potts for the pictures you find below):

Read more SURF-ing Alfresco on the snow