Building

Sling, Felix & oak

Source

SLING

Open source Java based Web framework designed to create content-centric applications on top of a Java Content Repository.

Source Location (Subversion):

https://svn.apache.org/repos/asf/sling

Felix

Apache Felix is an implementation of the OSGi Framework and Service platform.

Source Location (Subversion):

https://svn.apache.org/repos/asf/felix

Source Location (Subversion):

https://svn.apache.org/repos/asf/jackrabbit/oak/

Oak

Jackrabbit Oak is a Java Content Repository implementation designed to be the foundation for modern web applications.

Subversion

https://subversion.apache.org/

 

Subversion is a source control repository.

 

In subversion, every revision is a commit to the repository.  A commit is a collection changes including files and/or folders.

Subversion commands

Checkout - svn co

svn co http://svnserver/svn-repo/project-path - downloads ("checks out") the latest files from that path

svn -r {revision-id} co {url} - checks out a specific revision

 

Status - svn status

svn status - lists local changes

svn diff - shows diff of local changes vs. checked out version

SVN Project Structure

/project-name/trunk - latest unstable changes

 

/project-name/branches - branched changes of the code

e.g. Oak v1.2.x code is committed to oak/branches/1.2

 

/project-name/tags - released versions of code

If you are looking for a specific version of the project code.

e.g. Oak 1.2.7 code can be found under oak/tags/1.2.7 

Example

Check out Apache Sling Event Support bundle version 3.74 to the current working directory:

svn co http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.event-3.7.4

project name

Tags folder

containing

released versions

tag folder

of bundle

release

checkout

command

Apache felix svn repo

Apache Felix Project has a releases folder instead of tags

Modifying Code

Maven DEtails

Maven settings configuration:
{user-home}/.m2/settings.xml

Specifies which remote maven repositories to use.  https://maven.apache.org/settings.html

 

Local Maven Repository:

{user-home}/.m2/repository

Dependency jar files are downloaded here.

 

Project configuration:
pom.xml

Build details - project dependencies, plugins, etc.

https://maven.apache.org/guides/introduction/introduction-to-the-pom.html

Maven Commands

Run these commands where the pom.xml file is located.

 

mvn package

builds the project under the target directory of the project

 

mvn install

builds the project under the target

directory and copies the bundle to the local maven repostory under {user-home}/.m2/repository

 

mvn clean

Deletes files from the target folder.

Settings.xml

using Eclipse

Configure Maven Installation in Eclipse

Preferences => Maven => Installations => Add...

using Eclipse

Import the existing maven project from the file system

(Right click) Project Explorer => Import => Import... => Maven

=> Existing Maven Projects

using Eclipse

Select the project path

Browse... => Select Path => Finish

using Eclipse

Project would automatically build and download dependencies.  When it is done it looks like this:

using Eclipse

Search for the source files from stack traces in the logs.

Ctrl+Shift+T (windows) or Cmd+shift+T (Mac) to open the dialog

using Eclipse

Make the desired changes and build.

Right-click Project => Run As => Maven install

using Eclipse

Configure a custom build configuration

Right-click Project => Run As => Run Configurations... =>

Double-click "Maven Build"

using Eclipse

Modify the project version

Open the pom.xml file => edit the <version> by appending some identifying info "-cc#####"

using Eclipse

Run mvn clean package via a custom build configuration

Create the build config and click Run

Deploying the bundle to sling

Leverage the Sling JCR Installer

https://sling.apache.org/documentation/bundles/jcr-installer-provider.html

 

Use curl to install the bundle to the Sling server.

curl -v -u user:pass -T path/to/file.jar http://host:port/path/to/install/org.apache.sling.event-3.7.4-cc98105.jar

 

curl -v -u admin:admin -T target/org.apache.sling.event-3.7.4-cc98105.jar http://localhost:4506/libs/system/install/org.apache.sling.event-3.7.4-cc98105.jar

Apache Felix Console

In the Apache Felix bundles console:

http://host:port/system/console/bundles

we can see that our bundle is installed

Made with Slides.com