You are here

Importing SDK projects into IntelliJ

The Alfresco SDK is designed to work well with IntelliJ. This support includes the ability to import existing SDK projects (perhaps created via the command line) into IntelliJ.
This task assumes you completed the Installation section. This also assumes you have IntelliJ Community 13.1 (or better) installed.
You will learn how to import an existing Maven project into IntelliJ. Detailed instructions are available in the JetBrains IntelliJ documentation.
  1. Create a project to work with via the command line:

    mvn archetype:generate -Dfilter=org.alfresco.maven.archetype:
  2. Select the alfresco-amp-archetype option.
  3. Press Enter to select the latest archetype version.
  4. For groupId enter com.alfresco.tutorials.
  5. For artifactId enter intellij-project.
  6. For target version press Enter to select the latest Community version of Alfresco.

    The project will be created.

  7. Start IntelliJ.
  8. On the main menu, select IntelliJ IDEA > Preferences.
  9. Expand Maven and select Importing.
  10. Ensure that the Use Maven 3 to import project checkbox is cleared.

    Attention: This step is required to work around a bug in the current version of IntelliJ.
  11. On the IntelliJ main menu select View and ensure that the Tool Buttons menu item is checked.
  12. Click the Maven Projects tool button to open the Maven Projects tool view.
  13. Click the green '+' to add a Maven project.
  14. Navigate to the intellij-project directory in the Select Path dialog, and select the pom.xml file.
  15. Click OK.
  16. In the Maven Projects tool view expand your project and expand the Lifecycle folder.
  17. Double-click the install icon.

    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.

    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 01:01 min
    [INFO] Finished at: 2014-09-17T09:49:41+01:00
    [INFO] Final Memory: 39M/94M
    [INFO] -------------------------------------------------------------------------                        
  18. From the main menu select Run and Edit Configurations.... You can now create a Run Configuration for your project.
  19. Click the '+' and select Maven.
  20. In the Name field, enter a suitable name for the configuration such as "Alfresco project".
  21. In the Parameters tab, select the working directory for your project.
  22. In the Command line field enter integration-test.
  23. In the Profiles field enter amp-to-war.
  24. On the Runner tab enter the following into the VM Options field:

    -Xms1024m -Xmx4096m -XX:PermSize=1024m -javaagent:/Users/tbedford/Downloads/springloaded-1.2.0.RELEASE.jar -noverify                        
    Attention: You will need to edit the path to your Spring Loaded JAR file.
  25. Make sure the correct VM is selected (this should be the one you specified when you set up your JAVA_HOME environment variable in the install section of this documentation).
  26. Click Apply.
  27. Double check your settings.
  28. When satisfied your settings are correct click OK.
  29. To run the project, from the main menu, select Run > Run Alfresco project.
  30. The project will build (if required) and run.

    When you see the following message you know that Alfresco has started and is ready for log in:

    INFO: Starting ProtocolHandler ["http-bio-8080"]                    
  31. Point your browser at http://localhost:8080/alfresco.
  32. Log in as user admin with password admin.
You have seen how to import your SDK project into IntelliJ, and build and run it.

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.