AnsweredAssumed Answered

Custom Action with maven

Question asked by luca on Oct 12, 2016
Latest reply on Oct 13, 2016 by luca

Hi,

I tried to build a custom action with maven plugin, but I cannot understand how to add dependency from Alfresco internal classes, for example I need org.alfresco.web.app.Application. How can I do it?

 

I build the project with:

mvn archetype:generate -DarchetypeCatalog=https://artifacts.alfresco.com/nexus/content/groups/public/archetype-catalog.xml -Dfilter=org.alfresco.maven.archetype:

 

Using the simple AMP and also the All-in-One, but I cannot get the dependencies I wanted.

 

This is my pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>it.eng.alfresco</groupId>
    <artifactId>alfresco-doc-workflow-viewer</artifactId>
    <version>1.0-SNAPSHOT</version>
    <name>alfresco-doc-workflow-viewer AMP project</name>
    <packaging>amp</packaging>
    <description>Manages the lifecycle of the alfresco-doc-workflow-viewer AMP (Alfresco Module Package)</description>

    <parent>
        <groupId>org.alfresco.maven</groupId>
        <artifactId>alfresco-sdk-parent</artifactId>
        <version>1.1.1</version>
    </parent>


    <properties>
        <alfresco.groupId>org.alfresco</alfresco.groupId>
        <alfresco.version>4.2.e</alfresco.version>
        <app.log.root.level>WARN</app.log.root.level>
        <alfresco.data.location>alf_data_dev</alfresco.data.location>
        <alfresco.client.war>alfresco</alfresco.client.war>
        <alfresco.client.war.groupId>org.alfresco</alfresco.client.war.groupId>
        <alfresco.client.war.version>4.2.e</alfresco.client.war.version>
        <env>local</env>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>${alfresco.groupId}</groupId>
                <artifactId>alfresco-platform-distribution</artifactId>
                <version>${alfresco.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>${alfresco.groupId}</groupId>
            <artifactId>alfresco-repository</artifactId>
        </dependency>

        <!-- this one does not get the dependency that I want -->
        <dependency>
            <groupId>${alfresco.groupId}</groupId>
            <artifactId>alfresco</artifactId>
            <version>4.2.e</version>
            <type>war</type>
        </dependency>

        <dependency>
            <groupId>${alfresco.groupId}</groupId>
            <artifactId>alfresco-web-framework-commons</artifactId>
            <scope>provided</scope>
            <version>${alfresco.version}</version>
        </dependency>

        <!-- Test dependencies -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.8.1</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <repositories>
        <repository>
            <id>alfresco-public</id>
            <url>https://artifacts.alfresco.com/nexus/content/groups/public</url>
        </repository>
        <repository>
            <id>alfresco-public-snapshots</id>
            <url>https://artifacts.alfresco.com/nexus/content/groups/public-snapshots</url>
            <snapshots>
                <enabled>true</enabled>
                <updatePolicy>daily</updatePolicy>
            </snapshots>
        </repository>
    </repositories>
</project>

Outcomes