In order to follow this how-to you'll need the following on your computer:
Note: At the time of this writing, the Feature Model is not officially used by Sling. Until Sling is fully converted to the Feature Model, we'll have to use the Provisioning to Feature Model Converter Plugin. The plugin will create a Feature Model from each Provisioning Model file. The plugin will then assemble all the Feature Models into a single Feature Model file using the Feature Aggregate.
Start by creating a directory called myfeaturemodel
. We'll use this directory as our project workspace.
$ mkdir myfeaturemodel
We'll add two projects to this workspace:
$ cd myfeaturemodel
$ git clone https://github.com/apache/sling-org-apache-sling-starter.git
$ git clone https://github.com/apache/sling-org-apache-sling-kickstart.git
Your workspace should now look like this:
$ ls -l
drwxr-xr-x 15 user group 480 Jun 8 16:16 sling-org-apache-sling-kickstart
drwxr-xr-x 13 user group 416 Jun 8 16:10 sling-org-apache-sling-starter
The Kickstarter provides a Maven POM file called sling-fm-pom.xml
that converts the Sling Starter Provisioning Models to Feature Models. It then aggregates them into a single Feature Model.
$ cd sling-org-apache-sling-kickstart
$ mvn -f sling-fm-pom.xml install -Dsling.starter.folder=../sling-org-apache-sling-starter
Once the build is complete, you'll find a Feature Model file at sling-org-apache-sling-kickstart/target/slingfeature-tmp/feature-sling12.json
.
Before continuing, run one more Maven build in this directory as we will need a copy of the Kickstarter JAR in the next section.
$ mvn clean install
Now that we have a Feature Model file for Sling and a Kickstarter JAR, we are ready to create a new directory to execute Sling using the Kickstarter and the Feature Model we just created.
Begin, by changing into the parent workspace (myfeaturemodel
) and create a new directory to run the Kickstarter. Then, copy the Feature Model file and Kickstarter JAR.
$ cd ..
$ mkdir kickstart-run && cd kickstart-run
$ cp ../sling-org-apache-sling-kickstart/target/slingfeature-tmp/feature-sling12.json .
$ cp ../sling-org-apache-sling-kickstart/target/org.apache.sling.kickstart-0.0.3-SNAPSHOT.jar .
Lastly, let's start Sling using the Feature Model.
$ java -jar org.apache.sling.kickstart-0.0.3-SNAPSHOT.jar -s feature-sling12.json