Installing Apache Sling
To business, check out the latest Sling source tree with:
svn co http://svn.apache.org/repos/asf/incubator/sling/trunk sling
Stepping into the newly created sling directory, typing ‘svn info’ tells you exactly which version of Sling, you’re dealing with:
URL: http://svn.apache.org/repos/asf/incubator/sling/trunk Repository Root: http://svn.apache.org/repos/asf Repository UUID: 13f79535-47bb-0310-9956-ffa450edef68 Revision: 708302 Node Kind: directory Schedule: normal Last Changed Author: cziegeler Last Changed Rev: 708237 Last Changed Date: 2008-10-27 17:07:30 +0000 (Mon, 27 Oct 2008)
No surprises here, last changed author is Carston. If you stick with Sling, you’re going to see that name a lot. Now, before I started work on my trusty old MacBook Pro with 4Gb of memory, I upgraded from Maven 2.0.6 to 2.0.9. Also, I’m running Java 5:
java version "1.5.0_16" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_16-b06-284) Java HotSpot(TM) Client VM (build 1.5.0_16-133, mixed mode, sharing)
I then followed, to the letter, the discover-in-fifteen-minutes install page. Be sure to up the maven heap size before you start your install. The Apache Sling guys strongly that you MIGHT want to do this, but you really NEED to do this. Just set the environment variable as follows:
MAVEN_OPTS="-Xmx256M"
To build Sling, just make sure you’re connected to the web and issue the following command in the root directory:
mvn clean install
After building Sling from the source tree we ended with 443 Mb of fun. The maven repository, which I cleared down purely to get a feel for the stuff required to build sling came in at 195 Mb. Now, we know that a lot of this is required for maven to work its magic and to bombard Sling with tests. All in all, building Sling frm source on my mac book pro took nearly an hour. Most of that time was spent downloading jars. Another mvn clean install saw that build time come to down to a mere 4 minutes and 4 seconds…
After a successful build, jump into the launchpad/webapp directory and tap in the following:
mvn jetty:run
With sling up and running, go to http://localhost:8888/system/console/ to see what’s in the box. Sling runs within the Felix OSGi Container and as you can see below, the management console gives you access to all the available components. This Sling build was comprised of 84 bundles. Juicy!
Oh, forgot to mention that Sling is also packaged as an app that your can run out of a jar file. Step into the launchpad/app directory after a successful build and type in:
java -jar target/org.apache.sling.launchpad.app-4-incubator-SNAPSHOT.jar -c sling -f -
Note that this instance of Sling runs off a different port, http://localhost:8080/system/console/components
Next Steps
- Get familiar with running Sling
