10-12-2016 10:45 AM
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>
10-13-2016 11:38 AM
I finally resolved adding this to the pom.xml:
<dependency>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-web-client</artifactId>
<exclusions>
<exclusion>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-web-framework-commons</artifactId>
</exclusion>
</exclusions>
</dependency>
I had to add the exclusion because there are some missing artifact in the alfresco repository for this version of Alfresco (view this issue for further explanation: MNT-10118)
10-12-2016 11:52 AM
you can check your depedencie in your .m2 folder
m2/repository/org/alfresco/web/app/Application
if your depencie actually exist check his information in pom.properties (if not you have to install it )
for installing a dependencie with maven {{
mvn install:install-file -Dfile=[fichier AMP full path and name] -DgroupId=[GROUPID] -DartifactId=[AMP name without version] -Dversion=[AMP_VERSION] -Dpackaging=amp -DlocalRepositoryPath=[ [your .M2/repository] full path] (example D:\Users\username\.m2\repository)
}}
if its an internal class, just run your project and go check in m2 repository his presence
when its installed just add this in your pom
dont add this inside <dependencyManagement>
10-12-2016 02:44 PM
Hi Luca,
When you create alfresco all in one project you will have two different project generated one for repo and one for share.
In Repo project you will have all the alfresco dependencies available within it. When you run this command "mvn install -Pamp-to-war" It builds all your sources fetches all alfresco dependencies, deploy your customization and start dedicated tomcat container for your alfresco repository. So, you have all those dependencies downloaded by using those commands.
Well just noticed you are using very old version of maven sdk which was very early version of SDK. If possible switch to new sdk and latest alfresco version.
Different IDE have different ways to deal with maven project. Normally your IDE have maven as plugin. In that case make sure that plugin is pointing to correct maven repository in your machine.
10-12-2016 03:02 PM
I've already done as you suggested me, but I didn't get the dependency that I needed. I don't know if I have to use maven war overlay, as suggested here, or if I can add the dependency in some way.
I'm using that version of SDK because I'm using Alfresco 4.2.f CE and I want to add an action to the Alfresco Explorer frontend. SDK version > 2.0 seems to be compatible with at least Alfresco 5.0 (source)
10-13-2016 11:38 AM
I finally resolved adding this to the pom.xml:
<dependency>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-web-client</artifactId>
<exclusions>
<exclusion>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-web-framework-commons</artifactId>
</exclusion>
</exclusions>
</dependency>
I had to add the exclusion because there are some missing artifact in the alfresco repository for this version of Alfresco (view this issue for further explanation: MNT-10118)
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.