Search code examples
mavenintellij-ideaslingsightlysling-models

Sling deploy content and bundle with maven


Iam searching for a maven based solution to deploy apache sling bundle and content (including jsp/html, etc files) on my sling standalone server.

I stated this private project to learn about sightly and sling models without using AEM. It is my first only sling project.

Ive created a sling bundle and a sling content project from the specific archetypes. Ive stated working with the Eclipse Sling IDE tools, but iam used to IntelliJ and there is no plugin to deploy the contetent the same way. I think its possible to build and deploy a package with both (bundle and content) by using maven.

Hopefully someone of you have some instructions or ideas to solve this problem and make it more comfortable developing web projects with apache sling.

Cheers ;)


Solution

  • The maven-sling-plugin can install bundles in a Sling instance, and bundles can include initial content which is installed when they become active.

    The slingbucks sample demonstrates this, if you build it as shown below it will be installed in the Sling instance running on port 8080 and its initial content (defined under src/main/resources/SLING-CONTENT as specified in that module's pom.xml) will be installed:

    mvn clean install org.apache.sling:maven-sling-plugin:install -Dsling.url=http://localhost:8080/system/console
    

    If you use the Sling parent pom you can also use the autoInstallBundle profile to do the same thing using the default URL that that pom defines:

    mvn clean install -P autoInstallBundle