Obsolete Pages{{Obsolete}}
The official documentation is at: http://docs.alfresco.com
This page refers to an old version of the Maven support for Alfresco (pre Alfresco 4.x).
If you are using Alfresco Community 4.2.b+ or Alfresco Enterprise 4.1.2+, It is recommended now to use the new Maven Alfresco SDK 1.0.
A public repository hosting archetypes, plugins, Alfresco community (and enterprise as of June 2012) artifacts (with groupId org.alfresco and org.alfresco.enterprise respectively) is hosted by Alfresco at:
Releases Repo
Snapshots Repo
Alfresco Sites Repo
New Community and Enterprise artifacts will be made available here. See the dedicated wiki page for more details.
ATM archetypes don't use Alfresco POMs, because they are not officially available. Please vote for this issue if you wish to suggest Alfresco to make POMs available.
Until version 1.0.0 of Maven Alfresco Lifecycle (1.9.0 of Maven Alfresco Archetypes),
a public repository hosting archetypes, plugins and Alfresco community artifacts (with groupId org.alfresco) was available at Sourcesense
This repository is now deprecated for new releases of Alfresco artifacts.
If you are using Alfresco Community 4.2.b+ or Alfresco Enterprise 4.1.2, It is recommended now to use the new Maven Alfresco SDK 1.0.
A GREAT intro tutorial has been created here https://wiki.alfresco.com/wiki/Maven_For_Dummies
OUT OF DATE
If you are instead interested in the whole potential, please read on.
This page is intended to gather all efforts and achievements in the integration between Alfresco and Apache Maven,
especially focusing on managing Alfresco applications (extensions + AMPs) in enterprise environments started as of year 2007.
It's important to understand that this approach does *not* require Alfresco to be built with Maven, but provides support for integrating development *on top* of Alfresco with Apache Maven.
This project tries to merge efforts by the two forge projects maven4alfresco (maven-amp-plugin v.2.0.0 is assumed) and m2alfresco. The archetype project is hosted in Google Code while binaries are deployed on Alfresco Community Maven repository.
The whole support is wrapped under the name of Maven Alfresco Lifecycle and includes Archetypes and Plugins latest versions.
Tested with
Feel free to add here more platform you tested this against.
Use the maven-alfresco-extension-archetype to create WAR packaged webapps that can provide all Maven lifecycle and features. You can also use Maven standard dependency management to pull in AMPs in your build.
See details in the Maven Documentation Site.
Interactive mode
You can access the interactive mode command line project creation by running:
mvn archetype:generate -DarchetypeCatalog=https://artifacts.alfresco.com/nexus/content/repositories/releases/archetype-catalog.xml
then selecting the maven-alfresco-extension-archetype option and filling in your company details.
One liner
An even faster and non interactive (edit the groupId and artifactId matching your company information) one liner to create your project is:
mvn archetype:generate -DarchetypeGroupId=org.alfresco -DarchetypeArtifactId=maven-alfresco-extension-archetype -DarchetypeVersion=3.9.1 \
-DgroupId=com.mycompany -DartifactId=myalfresco -Dversion=1.0-SNAPSHOT -DarchetypeRepository=https://artifacts.alfresco.com/nexus/content/repositories/releases -DinteractiveMode=false
Customize your Alfresco edition
By default, the Alfresco edition that will be used is community; this information matches with the Maven classifier of the dependencies being fetched. You can customize it by editing the property <alfresco.edition> located in the <properties> section of your generated POM
This option applies to any archetype (mentioned in this page) that directly accesses Alfresco dependencies.
Run your Alfresco customized WAR in embedded Jetty (point your browser to http://localhost:8080/alfresco/):
mvn install -Prun
Run your Alfresco customized WAR and clean DB/alf_data :
mvn install -Prun,initialize
You can control the environmental properties and the build behaviour using properties and profiles (Maven profiles details).
NOTE: This Feature is only SNAPSHOT and not fully tested.
Use the maven-alfresco-share-archetype to create and manage Alfresco SHARE customization webapps, which can provide all Maven lifecycle and features to the lightweight SHARE development. Tested against Alfresco 3.2r2, which sample extensions are included. This allows to build a WAR package which then can depend on multiple Share modules (JARs as of Alfresco 3.3) produced with the Maven Alfresco Share Module Archetype (see next section).
You can simply access the interactive mode command line project creation by running:
mvn archetype:generate -DarchetypeCatalog=https://artifacts.alfresco.com/nexus/content/repositories/releases/archetype-catalog.xml
then selecting the maven-alfresco-share-archetype option and filling in your company details / project version.
An even faster and non interactive (edit the groupId and artifactId matching your company information) one liner to create your project is:
mvn archetype:generate -DarchetypeGroupId=org.alfresco.maven -DarchetypeArtifactId=maven-alfresco-share-archetype -DarchetypeVersion=3.9.1 \
-DgroupId=com.mycompany -DartifactId=my-custom-share -Dversion=1.0-SNAPSHOT -DarchetypeRepository=https://artifacts.alfresco.com/nexus/content/repositories/releases -DinteractiveMode=false
Note: The Share webapp is packaged with the pattern artifactId.war (e.g. in the example above, mycustomshare.war). Remember this when running Share in Jetty embedded (see below)
Run the SHARE in Jetty embedded (default 8081 not to clash with Alfresco running on 8080)
mvn install -Prun
Package and install the customization
mvn install
In order to include in your Share WAR Extension build Share (3.3+) JAR modules (either GA or built with the Maven Alfresco Share Module Archetype of next section) you just need to add a dependency snippet in your pom.xml, something like:
<dependencies>
<dependency>
<groupId>org.alfresco</groupId>
<artifactId>my-custom-share-module</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
</dependency>
</dependencies>
Main features are fully described in the Maven documentation site.
Available only from Alfresco 3.3: For background info see: http://blogs.alfresco.com/wp/kevinr/2010/01/28/alfresco-share-33-extensions-and-springsurf/
Use the maven-alfresco-share-module-archetype to create and manage Alfresco SHARE custom dashlets, pages as JARs. Tested against Alfresco 3.3-SNAPSHOT (latest CI build), which sample extensions are included.
This allows to build a JAR package which then can be depended upon by Share WARs produced with the Maven Alfresco Share Extension Archetype (see previous section) and have the plugin installed at build time.
You can simply access the interactive mode command line project creation by running:
mvn archetype:generate -DarchetypeCatalog=https://artifacts.alfresco.com/nexus/content/repositories/releases/archetype-catalog.xml
then selecting the maven-alfresco-share-module-archetype option and filling in your company details / project version.
An even faster and non interactive (edit the groupId and artifactId matching your company information) one liner to create your project is:
mvn archetype:generate -DarchetypeGroupId=org.alfresco.maven -DarchetypeArtifactId=maven-alfresco-share-module-archetype -DarchetypeVersion=3.9.1 \
-DgroupId=com.mycompany -DartifactId=my-custom-share-module -Dversion=1.0-SNAPSHOT -DarchetypeRepository=https://artifacts.alfresco.com/nexus/content/repositories/releases -DinteractiveMode=false
Note: The Share webapp is packaged with the pattern artifactId.war (e.g. in the example above, mycustomshare.war). Remember this when running Share in Jetty embedded (see below)
Once project is created in src/main/resources you already find a sample (tag list) which will be packaged as a Share JAR extension by just
mvn install
Then you can depend on it using the archetype at the previous section, or just drop the JAR in your Share instance and restart and that will magically install the site tags dashlets in your Share.
Use the maven-alfresco-amp-archetype to create
maven-amp-plugin managed webapps which can provide to Alfresco modules all Maven lifecycle and features. Also the maven-amp-plugin is used as a replacement to MMT to unpack AMPs into WARs (typically Alfresco Repository Extensions) builds, using the maven dependency mechanism provided by the maven-amp-plugin.
You can simply run the following command from a terminal or command prompt:
mvn archetype:generate -DarchetypeCatalog=https://artifacts.alfresco.com/nexus/content/repositories/releases/archetype-catalog.xml
then selecting the maven-alfresco-amp-archetype option and filling in your company details.
An even faster and non interactive (edit the groupId and artifactId matching your company information) one liner to create your project is:
mvn archetype:generate -DarchetypeGroupId=org.alfresco -DarchetypeArtifactId=maven-alfresco-amp-archetype -DarchetypeVersion=3.9.1 -DgroupId=com.mycompany \
-DartifactId=myamp -Dversion=1.0-SNAPSHOT -DarchetypeRepository=https://artifacts.alfresco.com/nexus/content/repositories/releases -DinteractiveMode=false
In the 'pom.xml' file, change the first <version> tag's value from '1.0-SNAPSHOT' to a version number that can be understood by Alfresco, such as '1.2.3.4'.
Test and install your AMP package:
mvn install
Deploy to a Maven remote repo
mvn deploy
The maven-amp-plugin is used to manage AMP lifecycle in both archetypes,
providing support for:
Alfresco Artifacts Repository
Maven Alfresco Discussion Group
old m2alfresco archetypes project