Getting and Building SlingPage edited by Mike MuellerChanges (1)
Full ContentGetting and Building SlingA quick guide for getting the Sling source, then building and running the resulting Sling instance; either without or with Eclipse. Sling can easily be built:
Note that you don't have to build Sling yourself, if you don't need the bleeding-edge stuff you can get prebuilt binaries from the Downloads page. A full build of Sling takes 5-10 minutes on a recent computer once your local Maven repository is up to date. The first build may take much longer than that if you start with an empty local Maven repository, as Maven will then download its plugins and all the required dependencies. PrerequisitesBefore you begin, you need to have the following tools installed on your system:
If you want to set up Eclipse (not required to build Sling) you'll also need the following installed:
Environment SetupThe full build process requires quite a lot of resources, so you may run into limits. The following hints should show you what to setup before building Sling. Java Heap Space
For 32bit platforms you should use MAVEN_OPTS="-Xmx256M -XX:MaxPermSize=256m" For 64bit platforms, you should use MAVEN_OPTS="-Xmx512M -XX:MaxPermSize=512m"
Configuring MavenSee MavenTipsAndTricks. Getting the Sling SourceWith SVN
With Eclipse Subversive or SubclipseFirst note how simple the above SVN instructions are...but if you really want to do this, read on. If you use the Subversive plugin make sure you have installed the "Subversive Integration for M2Eclipse Project" which can be found under the following Eclipse update site: http://community.polarion.com/projects/subversive/download/integrations/update-site/. Also, make sure that you have installed either the "Maven SCM handler for Subclipse" or the "Maven SCM handler for Subversive". Create a new workspaceIt's best to create a new workspace for the sling project:
Checkout the Sling source
Eclipse will now start to download the source and import the Maven projects. You might encounter some "Problem Occured" dialogs about "An internal error...", but just click OK on those and let Eclipse continue with the import. Be warned: This could take some time (it was 30 minutes on my laptop)! Possibly something in sling-builder might get a bit messed up (I didn't experience that problem, but Pontus reported it) then you can simply fix it with revert:
Building SlingWith the Maven command line tool
Messages should now be printed to the console which is being used as the "log file"; the -f command line option is set to -, indicating the use of standard output as the log file. The -c sling command line option instructs Sling to use the sling directory in the current directory for its data store, which is the Apache Felix bundle archive, the Jackrabbit repository data and configuration. You may also specify another directory here, either a relative or absolute path name (See also Configuration for more information). With M2Eclipse
Alternative setup in Eclipse without M2Eclipse pluginIn the case that you do not want to use the M2Eclipse plugin there's another setup that lets you have the automatic build turned on:
If you use "mvn clean install" to build Sling be sure you have set MAVEN_OPTS to "-Xmx384m -XX:PermSize=256m" otherwise you will probably get OutOfmemory errors. Congratulations ! You should now have a running Sling instance, that you can start playing around with. Further Tips and TricksDebug Sling in EclipseYou can use remote debugging to debug Sling in Eclipse, here's a little How-To
Now you should be able to set breakpoints, evaluate properties, and so on as usual. Debug Maven Tests in EclipseIn the same way as you can debug the sling app, you are also able to debug a maven test. Just run the maven tests like this mvn -Dmaven.surefire.debug test The tests will automatically pause and await a remote debugger on port 5005. You can then attach to the running tests using Eclipse. You can setup a "Remote Java Application" launch configuration via the menu command "Run" > "Open Debug Dialog..." (see above). Simple way to develop new bundle in Eclipse for SlingThe easiest way that I found is to create a new folder in the existing Eclipse workspace. After that you can follow these steps:
If adding dependencies to the poms, run mvn eclipse:eclipse again and refresh the project in Eclipse. Debugging works as described above.
Change Notification Preferences
View Online
|
View Changes
|
Add Comment
|
- [CONF] Apache Sling Website > Getting and Building Sling confluence
- [CONF] Apache Sling Website > Getting and Building Slin... confluence
- [CONF] Apache Sling Website > Getting and Building Slin... confluence
- [CONF] Apache Sling Website > Getting and Building Slin... confluence
- [CONF] Apache Sling Website > Getting and Building Slin... confluence