Prerequisites

See SDK Pre-Requisites to successfully run this archetype.

Project layout

The archetype generated project should look like:

  pom.xml
  src/main/amp  
            |-> module.properties
            |-> file-mapping.properties (optional)
            |-> config/
            |-> web/
            |-> licenses/
  src/main/java //Java classes to be packaged in the AMP embedded JAR)
  src/main/resources //resources to the packaged in the AMP embedded JAR
  src/main/resources/META-INF/resources //web resources to the packaged in the AMP embedded JAR, mapped to the root of the webapp as of Servlet 3.0)
  src/test/java // Unit tests
  src/test/resources // Unit test resources
  src/test/properties/<env> //  Environment aware alfresco-global.properties. By default <env>=local 

Basically by default the folder src/main/amp maps the AMP structure and it's where you can build your module.

Usage

This project manages an AMP and provides support for typical development lifecycle use cases like:

  • packaging
  • rapid development
  • testing (unit and integration)
  • run embedded
  • integration testing
  • release and distribution of your AMP artifact.

    The AMPs produced with this project are fully compatible with Alfresco MMT, in fact the Maven Alfresco plugin used to manage AMPs in this SDK embeds the official Alfresco MMT to install depdended AMPs.

Commands

run.sh will automatically set up the SDK and run the AMP on an Alfresco repo embedded to enable rapid development

Also, common AMP Maven lifecycle commands you want to run are:

  • mvn package: Runs unit tests and packages AMP in ${project.build.directory}/${project.build.finalName}.amp
  • mvn install: Like mvn package but also installs AMP in local Maven repository to be depended upon
  • mvn install -Dmaven.test.skip=true: Like mvn install but skips unit tests
  • mvn install -Pamp-to-war: Like mvn package -Pamp-to-war but also installs and runs the resulting WAR+AMP in Tomcat + H2 embedded from running and development. This also enables rapid application development features, like hot reloading and remote JUnit running. When you run this command then you can access in your browser .
  • mvn clean -Ppurge: Removes DB, alf_data, indexes and log files. Useful to purge the development repo (by default self contained in ${project.basedir}/alf_data_dev