Well, this was a long journey, but we are finally getting there! As was already announced, Alfresco Community is now built with Maven, and so will the next version of Alfresco One. We thought we would tell you a bit more about it.
Achievements unlocked
Alfresco is a BIG piece of software, and building it is not simple. There are several editions (Community, Enterprise, Cloud), several code generation steps, a huge number of external dependencies, etc. Also, a lot of quirks had accumulated in the Ant build over the years, as they do...
We couldn't just stop releasing for the few months while we did the migration. The difficult part was thus to make it progressive! Here are the steps we took
- June 2012: Deploying Alfresco artifacts to a Maven Repository
This was a popular request by customers and partners, who were already using Maven or Gradle. Gabriele Columbro had already started the job. We extracted the jars and wars of all past releases and uploaded them to http://artifacts.alfresco.com/
- November 2012: Adding dependency declarations
Initially, the pom.xml
files for these artifacts were empty. With Alfresco 4.1.2, we started writing and providing POM files that defined the dependencies, both between Alfresco artifacts and with 3rd party libraries. This was also the start of the parallel build: the same code was built in both Ant and Maven in our continuous integration, to make sure the POM files were correct.
- July 2013: Separating test classes
A big problem was that the main and test classes were mixed in the same source folders. Mao had find a nice hack to overcome that, by recreating a Maven standard layout on the fly in the target folder! But a complete separation was overdue, and we finally did it for Alfresco 4.2
- December 2013: MyAlfresco built with Maven
This happened under the hood. We had decided that the build of the Cloud version my.alfresco.com would be easier to switch to Maven: it only needs to support one platform, and the artifacts to build are much simpler. At the end of the year, the Maven build was deemed good enough to be put in production.
- February 2014: Separating unit tests from integration tests
This was mostly the work of Gethin James, who was tired of typing -DskipTests
... The default Maven build now fires only unit tests, so there is no need to worry about configuring the database or waiting for hours: Just type mvn clean install
🙂
If you depend on Alfresco artifacts coming from the Maven Repository, then you will have to change a few things to your builds. Hopefully not too much...
First, the infamous classifier=config
artifacts, which contained the resources of each jar file, have now gone. The resources are contained in the jar, as is standard in most places. If you depend on such artifacts, just remove them from your dependencies.
Second, the packaging of solr has changed. Instead of providing a zip that contains everything, we are again now conforming to the standard, and so
alfresco-solr
is simply a war file, which comes with its jar of classes (
classifier=classes
). Yes, and another artifact that contains the configuration (
classifier=config
), which should be unzipped on top of it if you need to run Solr.
At last, alfresco-mmt
is now a standalone executable jar, rather than a small jar with dependencies on third-party libraries, for convenience
A new version of the
Maven SDK is on its way, which will support Alfresco 5.0, along with a few added goodies. Thank you
Ole Hejlskov for your help with it!
What now?
The Enterprise version of Alfresco still requires a bit of work. This will be the last step before we can remove the Ant build completely - including all these annoying committed libraries!
Finally, there are most certainly a few remaining issues: missing artifacts, packaging mistakes, regressions, etc. Please tell us if you find anything!
You can now download
Alfresco Community 5.0.a Its artifacts are of course
in our Maven Repository. The version of Alfresco is now
5.0.a, and
5.0.b-SNAPSHOT for the nightly builds. We will keep the Ant-built
4.3.a-SNAPSHOT artifacts in the Maven repository for a while, to help the transition.
Thank you for your support in making it happen! We hope you are just as pleased as we are 🙂