A week or so ago Alfresco released version 3.0.0 of their Maven-based SDK. The release was pretty significant. There are a variety of places you can learn about the new SDK release:
- The official documentation discusses what’s new.
- Martin Bergljung wrote a guide here. (Why Google Docs? No idea. Maybe this is a draft?)
- The SDK project on Github
I recently revised all of the Alfresco Developer Series tutorials to be up-to-date with SDK 3.
Upgrading each project was mostly smooth. The biggest change with SDK 3.0.0 is that the folder structure has changed slightly. At a high level, stuff that used to go in src/main/amp now goes in src/main/resources. These changes are good–they make the project structure look like any other Maven-based project which helps other developers (and tools) understand what’s going on.
I did have some problems getting the repo to build with an out-of-the-box project which I fixed by using the SNAPSHOT rather than the released build.
Support for integration tests seems to have changed as well. I actually still need to work that one out.
Other than that, it was mostly re-organizing the existing source and updating the pom.xml.
A small complaint is that the number of sample files provided with the SDK has grown significantly, which means the stuff you have to delete every time you create a new project has increased.
I understand that those are there for people just getting started, but no one, not even beginners, needs those files more than once, so I’d rather not see them in the main archetype. Maybe Alfresco should have a separate archetype called “sample project” that would include those, and configure the normal archetype as a completely empty project. Just a thought.
The new SDK is supposed to work with any release back to 4.2 so you should be able to upgrade to the new version for all of your projects.
Hi Jeff,
Would you say it is necessary to upgrade to the new version for all projects, or will projects made with e.g. SDK2.2 still work on Alfresco? And if it is necessary, is it as simple as moving the files in the folders and updating the pom.xml?
Thanks
Marcus
Great question, Marcus, thank you.
You might want to take a look at the Alfresco SDK Compatibility Matrix. You’ll see that prior to SDK 3.0, each SDK had a limited set of Alfresco versions that it would work with. SDK 3.0 works with a wider range of versions. I believe it can work with everything from 4.2 all the way through the current 5.2 release. So if you have add-ons that you’ve developed that need to be able to support multiple Alfresco releases, it would probably be helpful to upgrade to SDK 3.0.
However, if you have only a handful of projects that only need to ever work with a single Alfresco release, you can stay on SDK 2.2 until you need to support Alfresco 5.2. A big caveat to that is if you would like to use hot-reloading. I believe this is broken in SDK 2.2. With SDK 3.0 you can use either JRebel or DCEVM to reload your Java classes in a running dev instance of Alfresco without a restart, which could save you a significant amount of time.
As for the upgrade, yes, it is really just a matter of re-organizing your files and updating your pom.xml.
Hi Jeff,
Thanks for replying. I do not have many projects so I will go ahead with updating them as it’s better to do it sooner rather than later. So far I haven’t had much trouble but one thing which is troubling me with the new SDK is that it clears the target directory every time I restart the server, which is a small problem for me as I am using custom freemarker templates for some of my share configurations.
I will investigate the hot-reloading today to see if it provides a solution to that, but if not is there any advice you have on this?
Thanks
Marcus
I assume you are using the run.sh or run.bat script. If you look inside that script it does a `mvn clean` which is why the target directory gets cleared out when you run it. You can adjust the script to not do a clean if that’s what you want.
I am confused about why that is a problem for you, though. If you have custom freemarker templates those should be in your project, not in your target directory. As a general rule, you should be fine with having your target directory deleted at any time because running maven to rebuild should result in fully-functional artifacts with everything you need.
Hi Jeff
Thanks again for replying. I did not realize you could define the custom .ftl files within the project directory (I’m quite new to this), but I’ve managed to get it working now, thank you!
Marcus
Hello Jeff, I´m learning alfresco customizations through your tutorial but after SDK 3.0 all of tutorial’s projects are with following error on pom.xml when imported to Eclipse: “No marketplace entries found to handle Execution generate-rebel-xml, in /someco-mvn-tutorial-share/pom.xml in Eclipse. Please see Help for more information.”
Please help me !!