Search code examples
mavenpom.xmlalfresco

Alfresco SK3 - JAR AIO Project dependencies


In the < SDK3 AMP projects, there was the ability to install-amps in the POM.xml when running from Eclipse. This would allow for an existing AMP(s) project to be applied when running/debugging from Eclipse. As we are changing our projects to JAR AllInOne projects, I'm wondering what the actual process is to duplicate this? "Project2" fails to run (mvn clean install alfresco:run) as our "Project2" JARs are dependent on models in the "Project1" Jars.

I thought the overlays section might do this but the model defined in "Project1" is not found when running "Project2" via maven. Previously when using the AMPs the install-AMPs section of the pom.xml would make sure that the dependencies webscripts/models were available at runtime. Is there a way to mimic this with two AIO Jar projects?


Solution

  • AIO projects with Alfresco SDK 3.0 can pull in other AMPs without a problem.

    Make sure that you've uncommented the part of the pom.xml that actually builds an AMP. Look for the section that starts like this:

    <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <version>2.6</version>
        <executions>
            <execution>
                <id>build-amp-file</id>
    

    And make sure it is uncommented.

    Once you've done that, you can add AMPs as both platform-tier dependencies and Share-tier dependencies. For a platform-tier dependency, look for the "" element and add your dependencies there, making sure to specify that the type is "amp".

    For a Share-tier dependency look for "".

    For example, I often like to install the JavaScript Console in my AIO projects because it is so handy. So, I add the following to platformModules:

    <!-- JavaScript Console -->
    <moduleDependency>
        <groupId>de.fmaul</groupId>
        <artifactId>javascript-console-repo</artifactId>
        <type>amp</type>
        <version>0.7-SNAPSHOT</version>
    </moduleDependency>
    

    And I add the following to :

    <!-- JavaScript Console -->
    <moduleDependency>
        <groupId>de.fmaul</groupId>
        <artifactId>javascript-console-share</artifactId>
        <type>amp</type>
        <version>0.7-SNAPSHOT</version>
    </moduleDependency>
    

    With those in place, when I run my AIO project using run.sh, Tomcat starts up, the JavaScript Console AMPs are installed, and my customizations are installed.