I am using alfresco 6.2 community. I used the AIO archtype. But when I "mvn clean install -DskipTests" All I get is a .jar file in the target directory, not an AMP. How do I fix this?
<?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> <artifactId>eisenhour-alfresco-extensions</artifactId> <name>Alfresco Platform/Repository JAR Module</name> <description>Platform/Repo JAR Module (to be included in the alfresco.war) - part of AIO - SDK 4.0 </description> <parent> <groupId>com.elpsolutions</groupId> <artifactId>alfresco</artifactId> <version>1.0-SNAPSHOT</version> </parent> <properties> </properties> <dependencies> <!-- https://mvnrepository.com/artifact/org.postgresql/postgresql --> <dependency> <groupId>org.postgresql</groupId> <artifactId>postgresql</artifactId> <version>42.2.18</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-assembly-plugin</artifactId> </plugin> </plugins> </build> </project>
Solved! Go to Solution.
By default jar based extensions are built. In order to get amps along with jars, you need to uncomment the "maven-assembly-plugin" plugin. Take a look at the parent pom.xml in your project and find the below given plug-in.
Example for your reference: https://github.com/abhinavmishra14/alfresco-mimetype-blocker/blob/master/pom.xml#L125
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-assembly-plugin</artifactId> <version>2.6</version> <executions> <execution> <id>build-amp-file</id> <phase>package</phase> <goals> <goal>single</goal> </goals> <configuration> <appendAssemblyId>false</appendAssemblyId> <descriptor>src/main/assembly/amp.xml</descriptor> </configuration> </execution> </executions> <dependencies> <dependency> <groupId>org.alfresco.maven.plugin</groupId> <artifactId>alfresco-maven-plugin</artifactId> <version>${alfresco.sdk.version}</version> </dependency> </dependencies> </plugin>
When using any external or different amp module in your project you need to add the dependency with following:
<exclusions> <exclusion> <groupId>*</groupId> <artifactId>*</artifactId> </exclusion> </exclusions>
You can find a note in the platform-docker and share-docker projects about this. Example of adding an amp based dependency, note the exclusions part.
<dependency> <groupId>de.fmaul</groupId> <artifactId>javascript-console-repo</artifactId> <type>amp</type> <version>0.6</version> <exclusions> <exclusion> <groupId>*</groupId> <artifactId>*</artifactId> </exclusion> </exclusions> </dependency>
By default jar based extensions are built. In order to get amps along with jars, you need to uncomment the "maven-assembly-plugin" plugin. Take a look at the parent pom.xml in your project and find the below given plug-in.
Example for your reference: https://github.com/abhinavmishra14/alfresco-mimetype-blocker/blob/master/pom.xml#L125
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-assembly-plugin</artifactId> <version>2.6</version> <executions> <execution> <id>build-amp-file</id> <phase>package</phase> <goals> <goal>single</goal> </goals> <configuration> <appendAssemblyId>false</appendAssemblyId> <descriptor>src/main/assembly/amp.xml</descriptor> </configuration> </execution> </executions> <dependencies> <dependency> <groupId>org.alfresco.maven.plugin</groupId> <artifactId>alfresco-maven-plugin</artifactId> <version>${alfresco.sdk.version}</version> </dependency> </dependencies> </plugin>
When using any external or different amp module in your project you need to add the dependency with following:
<exclusions> <exclusion> <groupId>*</groupId> <artifactId>*</artifactId> </exclusion> </exclusions>
You can find a note in the platform-docker and share-docker projects about this. Example of adding an amp based dependency, note the exclusions part.
<dependency> <groupId>de.fmaul</groupId> <artifactId>javascript-console-repo</artifactId> <type>amp</type> <version>0.6</version> <exclusions> <exclusion> <groupId>*</groupId> <artifactId>*</artifactId> </exclusion> </exclusions> </dependency>
Ahh, so obvious, the PARENT pom. I was just building the alfresco-platform. But you are saying that if I add the exclusions to say alfresco-share, It would create an AMP?
Uncommenting the "maven-assembly-plugin" would start creating amps along with jars as well. Even if you build alfresco-platform sub-project, and if "maven-assembly-plugin" is enabled, you would get jar and amp both for that sub-project.
Hi @mangar
Glad you got it resolved & thanks for accepting the solution - that's helpful to other users.
Kind regards,
Hi, Abhinav!
1) Can you explain please why it is required to add <exclusions>?
<exclusions> <exclusion> <groupId>*</groupId> <artifactId>*</artifactId> </exclusion> </exclusions>
What is it required for?
It is really not obvious - I tried with and without and did not notice any difference.
2) Also pom contains comment:
If using amp extensions only, add <includeTypes>amp</includeTypes> to the "collect-extensions" execution below.
Can you explain also this - in what cases it is used?
Thanks in advance.
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.