Posts

Showing posts from June, 2019

AEM – Create Maven project using archetype

Image
To create a simple AEM project using Maven you can use latest archetype from Adobe. Have a look at the GitHub project https://github.com/adobe/aem-project-archetype To create new project use following command: mvn archetype:generate -DarchetypeGroupId=com.adobe.granite.archetypes -DarchetypeArtifactId=aem-project-archetype -DarchetypeVersion=19 -DoptionIncludeExamples=y -DoptionIncludeErrorHandler=y This will ask series of questions/inputs while generating project e.g. apps folder name, site name etc. Once project folder structure is generated you can use the following command to build and install it on locally running AEM instance using following command: mvn clean install -PautoInstallPackage NOTE: Make sure that your AEM instance is running and it is running on port 4502. If you want to change host or port, please refer to pom.xml (available in root) of the generated project.

Maven profiles – Operating Systems (OS) specific build profiles

Maven is a powerful build framework and it allows us to customize every aspect of build with simplicity. In this article, we’ll learn about how to create different build profiles for windows and Mac OS. The same concept can be replicated to other operating systems or environment specific builds. Let’s define a use case. Let’s say we have project in which we want to compile and package Angular 2+ project using maven build. Angular 2+ project is dependent on Node.js (npm) and Angular CLI (ng CLI). We can use Maven Exec plugin for invoking npm and ng CLI commands. On Mac OS “npm” and “ng” commands works without any additional extension. To run same commands on Windows operating system we need to append .cmd extension. This means if we have mixed folks in development team who uses both Windows and Mac OSx then every time pom.xml file needs to be updated. What if someone pushes this file to central code repository? This will obviously break the builds on CI/CD (e.g