Use following helpful link:
https://helpx.adobe.com/experience-manager/using/first-osgi.html
Step 1: you must have following things setup
- Java
- Maven
Step 2: Run following command to generate project type
mvn archetype:generate -DarchetypeRepository=http://repo.adobe.com/nexus/content/groups/public/ -DarchetypeGroupId=com.day.jcr.vault -DarchetypeArtifactId=multimodule-content-package-archetype -DarchetypeVersion=1.0.2 -DgroupId=com.adobe.cq -DartifactId=key61 -Dversion=1.0-SNAPSHOT -Dpackage=com.adobe.cq -DappsFolderName=myproject -DartifactName="My Project" -DcqVersion="5.6.1" -DpackageGroup="My Company"
A project will be generated for you.
Setp 3:
Go to bundle folder, open pom.xml
file under <artifactId>maven-sling-plugin</artifactId>
add following
<version>2.3.0</version>
The above is important, because old version had an issue which raises problem during build execution. You can read more about the issue here adobe/aem-project-archetype#56
Step 4: You can now run build by following command:
mvn clean install -PautoInstallBundle
The above command will assume that you are running your instance on 4502 port. to change port modify command as following
mvn clean install -PautoInstallBundle -Dcrx.port=4503
Now, goto your /system/console/bundles/ URL and filter the bundles by typing the name of project you selected. Default is 'My Project'