Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Best practice for creating AEM maven project with just bundle(Java) code

Avatar

Level 1

I have a requirement where I need to build some services in AEM. Usually I create a maven project in AEM using multi-module-content-package-archetype which creates two folders i.e content and bundle. To build the project I use "mvn -PautoInstallPackage clean install" from the root directory where the project parent pom exists and it builds a package and installs it into my local server. Now in this case if I just want a bundle, can I delete the content folder and just have a bundle folder present ?

If I delete the content folder, and I use "mvn -PautoInstallBundle clean install" from the project root directory to build the project, it directly installs the bundle in OSGI console on my local server. With this approach, since I dont have a content folder there will not see any folder related to this project in apps folder in crxde. Is this a best practice ? Else do I need both content and bundle for this kind of use case as well ?

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

Please revisit your process. Although you can replicate your content packages (with the embedded OSGI bundles). But in this approach (using replication) you loose control about your publishs for a moment. If all publishs restart bundles at the very same time and do not respond properly with HTTP status codes 200, you risk your site to be unavailable.

Rather use a blue-green-deplyoment approach and deploy only 1 half of your publishs at a time. This might rule out replication (of course you can play around with the replication agents to delay the replication to the "active" publishs) and you have to install using the package manager (either manually or automated).

Jörg

View solution in original post

4 Replies

Avatar

Employee Advisor

My experience is that you should deploy all bundles as part of a content package. Deploying the bundle directly into OSGI works on local development machines, but it typically does not any higher stage; do not use maven to deploy bundles into production!

But it's definitly not required to have a dedicatedcontent package for every single bundle. When I have multiple bundles in my projects, I typically have 1 content package where all bundles are embedded. And then this package gets deployed to all environments.

HTH,

Jörg

Avatar

Level 1

That makes sense now !!

if I install the content package in author server, I can just replicate it to all publish servers. Where as if I just install bundle directly on author server I don't think there is an option to replicate it to publish servers. We need to go in manually to all publish servers to install the bundle I guess.

Avatar

Correct answer by
Employee Advisor

Please revisit your process. Although you can replicate your content packages (with the embedded OSGI bundles). But in this approach (using replication) you loose control about your publishs for a moment. If all publishs restart bundles at the very same time and do not respond properly with HTTP status codes 200, you risk your site to be unavailable.

Rather use a blue-green-deplyoment approach and deploy only 1 half of your publishs at a time. This might rule out replication (of course you can play around with the replication agents to delay the replication to the "active" publishs) and you have to install using the package manager (either manually or automated).

Jörg