Configure your development environment

During the lab, you will be configuring your development environment using Eclipse and Maven.

  1. Install Maven from https://maven.apache.org/install.html
  2. If it doesn't already exist, create a sub-folder with name .m2 in your user home directory ($USER_HOME).
  3. Unzip the repository-training.zip file into your $USER_HOME/.m2/ directory. It should create a new $USER_HOME/.m2/repository-training directory containing a local Maven repository pre-populated with the required artifacts for the labs.
  4. Create/update your Maven settings file in $USER_HOME/.m2/settings.xml to add the Componize Maven servers and archetype information:
    <?xml version="1.0" encoding="UTF-8"?>
    <settings>
    
      <localRepository>C:/Users/JohnDoe/.m2/repository-training</localRepository>
    
      <activeProfiles>
        <activeProfile>archetype</activeProfile>
      </activeProfiles>
    
      <profiles>
        <profile>
          <id>archetype</id>
          <repositories>
            <repository>
              <id>archetype</id>
              <url>https://maven.componize.com/releases/</url>
              <releases>
                <enabled>true</enabled>
              </releases>
              <snapshots>
                <enabled>false</enabled>
              </snapshots>
            </repository>
          </repositories>
        </profile>
    
      </profiles>
    
      <servers>
        <server>
          <id>archetype</id>
          <username>...</username>
          <password>...</password>
        </server>
    
        <server>
          <id>componize-public-snapshots</id>
          <username>...</username>
          <password>...</password>
        </server>
    
        <server>
          <id>componize-public-releases</id>
          <username>...</username>
          <password>...</password>
        </server>
      </servers>
    
    </settings>
    Replace ... with your Componize support username/password
  5. (Optional) If you want to use the Enterprise version of Alfresco, update your Maven settings file in $USER_HOME/.m2/settings.xml to add the Alfresco Maven server:
    <server>
      <id>alfresco-private</id>
      <username>...</username>
      <password>...</password>
    </server>          
    Replace ... with your Alfresco support username and password
  6. Run the following Maven command and select the componize-alfresco-archetype:
    mvn archetype:generate
    Specify a groupId and artifactId of your choice.
    Note: Do not use componize as the artifactId, it will conflict with the default Componize artifacts.
    This will create a new boilerplate project structure for storing your Componize and Alfresco extensions and packaging them with Maven.
  7. Run the previous Maven command again and select the componize-samples-archetype:
    Enter the same groupId and artifactId specified in the previous step.
    This will install the lab samples files into the previously created projects.
  8. Install your Eclipse application by unzipping the eclipse-java-*.zip file on your computer.
  9. Open your Eclipse Application and use the File > Import ... action. Select Existing Maven Projects in the pop-up then select your project folder to import.
  10. Right click on your Eclipse project and run the Maven > Update Project action.
  11. Install MySql Database using the installer mysql-installer-community-*.msi to be able to run the Alfresco unit tests
  12. Update the JVM paramerters in Eclipse using the following arguments in addition to making sure you're using a JDK and not a JRE:
    -Xms1g -Xmx1g -ea -Dmysql.rootPassword=<your-MySQL-password>
  13. On the parent project POM file, right click to launch the Run as … > Maven build … wizard
    Add the clean and package goals, and check the Skip Tests option
At the end of the lab, your Eclipse project should compile without errors and the Maven build should run successfully.