AlfrescoSDK – Importing SDK projects into IntelliJ IDEA

This task assumes you completed the Installing and configuring software section and generated a project as described in this section.
You will learn how to import an existing Maven project into IDEA.
  1. First, make sure IDEA is using the correct Maven installation (3.2.5 or newer). In the main menu, select File > Settings….

    In the IDEA Settings dialog you should see something like this:

  2. Then check that you are using JDK 8, In the main menu, select File > Project Structure….

    In the IDEA Project Structure dialog you should see something like this:

  3. Now, in the main menu, select File > Open…
  4. Navigate to where the project’s parent pom is located, in this case the AIO parent pom.

    You should see a dialog looking something like this when you have located an All-in-One (AIO) project:

  5. Select the pom.xml file for the All-in-One parent project.
  6. Click OK. The project is now imported and should appear in the Project tool view to the left.
  7. Enable Alfresco Enterprise edition (Optional)

    If your project is using the Enterprise edition of Alfresco you also want IDEA to load the enterprise versions of the Alfresco WARs and related libraries. You can do this by enable the enterprise profile. In the Maven Projects tool view to the right expand the Profiles folder, then check the enterprise profile. You should see a dialog looking something like this:

  8. Now use Maven to build the All-in-One (AIO) project. Do this by executing the install command on the parent AIO project. In the Maven Projects tool view to the right expand the parent pom, then expand the Lifecycle folder.

    You should see a dialog looking something like this:

  9. Double-click the install plugin goal.

    The project will build, and information will be displayed in the Console. You will see a message similar to the following, indicating that the project was successfully built.

    /usr/lib/jvm/java-8-oracle/bin/java -Xms256m -Xmx1G -XX:PermSize=500m -javaagent:/home/martin/libs/springloaded-1.2.3.RELEASE.jar -noverify -Dmaven.home=/usr/local/apache-maven-3.2.5 ......  install
    [INFO] Reactor Summary:
    [INFO] Alfresco Repository and Share Quickstart with database and an embedded Tomcat runner. SUCCESS [  0.387 s]
    [INFO] Alfresco Repository AMP Module ..................... SUCCESS [ 38.368 s]
    [INFO] Alfresco Share AMP Module .......................... SUCCESS [  0.734 s]
    [INFO] Alfresco Repository WAR Aggregator ................. SUCCESS [ 11.000 s]
    [INFO] Alfresco Solr 4 Configuration ...................... SUCCESS [  0.028 s]
    [INFO] Alfresco Share WAR Aggregator ...................... SUCCESS [  9.903 s]
    [INFO] Alfresco, Share and Solr4 Tomcat Runner ............ SUCCESS [  0.007 s]
    [INFO] ------------------------------------------------------------------------
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 01:01 min
    [INFO] Finished at: 2015-05-06T11:28:02+01:00
    [INFO] Final Memory: 61M/503M
    [INFO] ------------------------------------------------------------------------
    Process finished with exit code 0
    Attention: You should see that the MAVEN_OPTS setting has been picked up by IDEA, look at the first line of the log.
You have seen how to import your SDK project into IntelliJ and how to build it.

Read more….

  • Rapid Application Development in IntelliJ IDEA (Hot reloading) | Alfresco Documentation


    Configure Share AMP projects to Refresh Webapp (share.war)

    The All-in-One project has one Share AMP project by default (all-in-one/share-amp), we need to set up IDEA so that when we build via IDEA (that is, not via Maven) a script runs that will refresh the Surf Web Script container and clear dependency caches. In the Maven Projects tool view to the right expand the Alfresco Share AMP Module folder, then expand thePlugins folder. Now expand the alfresco plugin folder. Right click on the alfresco:refresh-share goal of the plugin. In the drop down menu select Execute After Make. You should now see a dialog looking something like this:

    If you are working with multiple Share AMPs, then you need to do this configuration for each one of them.

    Important:You only need to do this if you are doing customizations for the Alfresco Share webapp (that is, customizing share.war). If you are just customizing the repository, see the previous configuration.

    Now build(Make) the project by clicking Ctrl+F9

    The message console in IDEA should display BUILD SUCCESS.

    Refresh the Repository Web Script page from the Browser or refresh from Admin http://localhost:8080/alfresco/

Other common usage supported by this archetype includes the following:

Command Description
mvn package Runs unit tests and packages AMP in ${}/${}.amp
mvn install Like mvn package but also installs AMP in local Maven repository to be depended upon
mvn test Runs unit tests
mvn install -DskipTests=true Like mvn install but skips unit tests
mvn install -Prun Like mvn install but also triggers the runner project to run Alfresco, Share, Solr and Web Quick Start in Tomcat (with H2 embedded database)
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.

Note:This is an important command to use if you change significant settings in your project – for example you change the Alfresco edition from Community to Enterprise. It is important to purge databases and other data that might otherwise be persisted.
mvn install -Pamp-to-war,rad Similar to mvn install -Pamp-to-war but also adds support for remote JUnit running and for hot reloading with JRebel (requires appropriate MAVEN_OPTS configuration).

admin has written 55 articles