You are here

Share AMP archetype

The Alfresco SDK Alfresco AMP archetype can be used to create an AMP-based project for Share.
This task assumes you have completed all instructions in the Installation section of this documentation.
This task shows how you can use the Share AMP archetype of the Alfresco SDK to generate a Share project.
  1. Create a suitable directory in which to store all your Maven projects (if you have not already done so), such as maven_projects.
  2. Change into your maven_projects directory.
  3. Run the following command:

    
    mvn archetype:generate -Dfilter=org.alfresco.maven.archetype:
    
            
    Attention: As the archetypes are available via Maven Central you do not need to specify a catalog.

    You will be prompted to choose an archetype:

                        
    Choose archetype:
    1: remote -> org.alfresco.maven.archetype:alfresco-allinone-archetype (Sample multi-module project for All-in-One development on the Alfresco plaftorm. Includes modules for: Repository WAR overlay, Repository AMP, Share WAR overlay, Solr configuration, and embedded Tomcat runner)
    2: remote -> org.alfresco.maven.archetype:alfresco-amp-archetype (Sample project with full support for lifecycle and rapid development of Repository AMPs (Alfresco Module Packages))
    3: remote -> org.alfresco.maven.archetype:share-amp-archetype (Share project with full support for lifecycle and rapid development of AMPs (Alfresco Module Packages))
    Choose a number or apply filter (format: [groupId:]artifactId, case sensitive contains): : 
    
    
  4. Enter 3 to have the SDK create an Share project.

    The detailed documentation for this archetype can be found here.

  5. You will be prompted to choose an archetype version:

                            
    Choose org.alfresco.maven.archetype:share-amp-archetype version: 
    1: 2.0.0-beta-1
    2: 2.0.0-beta-2
    3: 2.0.0-beta-3
    4: 2.0.0-beta-4
    5: 2.0.0
    Choose a number: 5: 
                            
                        

    Hit Enter to select the default (which is the most recent version).

  6. You will then be prompted to enter a value for the property groupId. Enter com.alfresco.tutorials for the groupId (this can be thought of as the package name).
  7. You will then be prompted to enter a value for the artifactId. Enter simple-share-project as the artifactId. This can be thought of as the project name. Note, hyphens are typically used in project names.
  8. You will then be prompted to enter a value for the Alfresco version you wish to test against (currently the default is 5.0.c). Hit the Enter key to accept the default value.

    A new project directory containing a number of sub-directories and support files for the AMP will be created in the directory simple-share-project.

  9. Change into the freshly created simple-share-project directory and browse the various files and directories to see what has been created.

    The following directory structure has been created for you:

    
        pom.xml // Maven project file
        run.sh  // script to download Spring Loaded if required and run your project
        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/test/java // Unit tests
        src/test/resources // Unit test resources
        src/test/properties/<env> // Environment aware alfresco-global.properties. By default <env>=local                         
        tomcat/ 
    
    

    Look in the directory ./src/main/amp. Notice important files, such as the module.properties file, have been created for you.

  10. At this point, before you have made any changes, you can build the project by typing:

                            
    mvn install                        
                            
                        
    Attention: Maven will ensure that all requirements are downloaded. This make take some time.

    The project will return with the message BUILD SUCCESS.

  11. You can build, load RAD requirements, and run your project by typing:

    
    ./run.sh                        
                            
                        
    Attention: You may first need to make the shell script executable using the command chmod +x run.sh.
  12. Once the web application has started (it may take a little while), point your browser at http://localhost:8081/share.
  13. Log into Share using a username of admin and a password of admin.

    Attention: You will need to have already started a repository for Share to connect to. This can most conveniently be done by running up an AMP archetype project.
In this tutorial you have learned how to deploy and run a project using the Share AMP archetype.

Sending feedback to the Alfresco documentation team

You don't appear to have JavaScript enabled in your browser. With JavaScript enabled, you can provide feedback to us using our simple form. Here are some instructions on how to enable JavaScript in your web browser.