This tutorial explains how you can create custom Magnolia webapps with Maven. Using Maven allows you to customize your webapps with the POM files, which can be tracked with a version control system like Git. A tailored webapp makes building and deploying faster and has a positive impact on the performance of your instances. With Maven, you can streamline your Magnolia project to meet the specific demands of the project.

If you just want to try out Magnolia, follow instead the tutorial called How to get and adapt a bundle with Magnolia CLI.

Introduction

What is a webapp?

A Java Web Application (webapp) is a collection of servlets, other Java classes, static resources such as HTML pages, other resources, and meta information that describes the webapp bundled together. You can run a webapp on a servlet container. A Java webapp has a typical structure. It can be packaged as a WAR file. A webapp usually contains already packed portions called libraries or modules as JAR files.

Magnolia provides several preconfigured webapps and bundles. Some of them are ideal candidates as a starting point to build your custom webapp.

Magnolia provides the following stand-alone, pre-configured Apache Tomcat server that does not include a webapp:
Artifact

Download


Usage / purpose

magnolia-tomcat-barebone

A preconfigured Tomcat server ready to be used together with any Magnolia webapp.


Magnolia provides the following webapps and bundles.

Artifact


 Download


 With Travel demo


 With EE Standard modules


 With EE Pro modules


 With Apache Tomcat

UsageModule summary1
Cloud edition






magnolia-cloud-webapp
(tick)(tick)
The standard Magnolia cloud offer bundles a selection of enterprise-level modules, including connectors enabling you to integrate third-party systems, tools and data sources.See Supported modules in the cloud.

magnolia-cloud-dev-webapp


(tick)(tick)


Enterprise level webapp specifically built for testing Magnolia Cloud development work locally.See Supported modules in the cloud .
magnolia-cloud-headless-webapp
(tick)(tick)
Bundles a lighter selection of enterprise-level modules enabling you to create content and use it in headless deployment scenarios.See Supported modules in the cloud - Headless cloud bundle modules .
Community edition

magnolia-empty-webapp





This is the most basic Magnolia webapp. Use this as a base for custom tailored webapp.Core modules from main and ui, Cache (core and ehcache), Pages, Resources, Publishing, Security and Scheduler.

magnolia-community-webapp





Complete Magnolia community edition webapp; no demo project.Same as magnolia-empty-webapp plus:
Cache tools,  Cache Browser, Categorization, Commenting, Contacts, DAMFind Bar, Form , Groovy, Mail, Messages, MTE , REST and Site.

magnolia-community-demo-webapp

(tick)


Same as magnolia-community-webapp plus the travel demoTravel demo community edition 2
magnolia-community-demo-bundle(tick)

Tomcat-bundle including magnolia-bundled-webapp and travel demoTravel demo community edition 2

Enterprise Standard edition

magnolia‑enterprise‑standard‑webapp


(tick)

Same as magnolia-community-webapp plus Enterprise Standard modules; no demo

Backup, Content Dependencies, Content Translation Support, Diff, Marketing Tags, Personalization, Privacy module, Publishing Transactional, Soft Locking and Workflow.

magnolia‑enterprise‑standard‑demo‑webapp

(tick)(tick)

Same as magnolia‑enterprise‑standard‑webapp plus the travel demoTravel demo Enterprise Standard edition 3
Enterprise Pro edition  

magnolia-enterprise-pro-webapp


(tick)(tick)
magnolia-enterprise-standard-webapp plus Enterprise Pro module(s); no demo

Backup, Content Dependencies, Content Editor, Content tagging, Content Translation Support, Diff, Image Recognition module, Marketing Tags, PersonalizationPrivacy module Publishing Transactional, Soft Locking, Workflow and Multisite.

magnolia-enterprise-pro-demo-webapp(tick)(tick)(tick)
magnolia-enterprise-pro-webapp plus the travel demoTravel demo enterprise pro edition 4
magnolia-enterprise-pro-demo-bundle(tick)(tick)(tick)
Tomcat bundle with magnolia-enterprise-webapp including travel demoTravel demo Enterprise Pro edition 4
magnolia-enterprise-installer(tick)(tick)(tick)
Installer for magnolia-enterprise-pro-demo-bundle

magnolia-enterprise-weblogic-webapp

(tick)(tick) 5(tick)
Webapp based on magnolia-enterprise-webapp including travel demo; tuned for Weblogic without workflow 5Travel demo Enterprise Pro edition 4

magnolia-enterprise-websphere-webapp

(tick)(tick) 5(tick)
Webapp based on magnolia-enterprise-webapp including travel demo; tuned for Websphere without workflow 5Travel demo Enterprise Pro edition 4

(1) The module summary does not list all modules but provides a good summary. To get the complete list of the modules, look at the corresponding pom file of the bundle.
(2) Travel demo Community edition contains the following modules: magnolia-travel-demo, magnolia-travel-tours.
(3) Travel demo Enterprise Standard edition contains the following modules: magnolia-travel-demo, magnolia-travel-tours, magnolia-travel-demo-personalization, magnolia-travel-demo-marketing-tags.
(4) Travel demo Enterprise Pro edition contains the following modules: magnolia-travel-demo, magnolia-travel-tours, magnolia-travel-demo-personalization, magnolia-travel-demo-marketing-tags, magnolia-travel-demo-multisite.
(5) Both magnolia-enterprise-weblogic-webapp and magnolia-enterprise-websphere-webapp contain all Enterprise Standard and Pro modules but not those for workflow.


Requirements

We assume that you are familiar with Maven and the basics of POM files. Your Maven settings should comply with the Magnolia Maven setup, which provides access to the Magnolia Nexus repositories, and thus ensures that you can build the webapps described in the examples. If you are new to Magnolia, we recommend that you first carefully follow the Maven setup page.

When creating a custom webapp, you have to decide whether your webapp will contain Enterprise modules or only Community edition modules. If you go for the Enterprise Edition, you need credentials to access the Enterprise repositories on Nexus and you also need an Enterprise license to run the Enterprise webapps. If you don't have the Enterprise credentials yet, but want to try out the Magnolia Enterprise Edition, apply for a trial license.

Possible approaches

This section describes two approaches to define a custom webapp with Maven. For both of them, keep in mind the following:

Best practice

To create a custom Magnolia webapp, always start with a preconfigured Magnolia webapp.

A minimal webapp and adding modules

If your aim is a minimalistic webapp, we recommend using the magnolia-empty-webapp as a base for your webapp project. it is also the base for every Magnolia webapp and provides the essentials such as the Core and UI modules. This approach is applied on the subpage Creating a minimal webapp with Maven. It could be suitable for you, if you aim at creating a custom headless instance.

A feature-rich webapp and excluding modules

Most of the preconfigured Magnolia webapps come with a feature-rich set allowing you to accomplish a number of different tasks and run complex websites. The most prominent preconfigured Magnolia webapps are these:

  • magnolia-community-webapp
  • magnolia‑enterprise‑standard‑webapp
  • magnolia-enterprise-pro-webapp

The second example — Creating an EE Pro webapp with Maven — uses the magnolia-enterprise-pro-webapp as a starting point. We then exclude some modules which are not necessary for the example use case.

When creating a feature-rich webapp, you cannot only exclude modules, you also need to add additional modules. Usually, it is common to do both, exclude and add modules.

Procedure overview

  1. Create a webapp skeleton from a Magnolia Maven archetype.
  2. Modify the POM files according to your needs.
  3. Add additional resources, if necessary.
  4. Build the webapp.

Creating an archetype-based webapp skeleton

Just as Maven provides archetypes to create a typical skeleton for Maven projects, Magnolia too provides an archetype to create a skeleton for a Magnolia Maven project. The Magnolia archetype comes with options for different tasks. Here, we use the magnolia-project-archetype. It is an archetype that creates a Magnolia project with its parent POM and a webapp with its own POM.

(warning) Before running the maven archetype command, please read How to use Magnolia Maven archetypes: Check Maven settings

If you are not familiar with the Maven archetype plugin, please also read How to use Magnolia Maven archetypes: The archetype plugin.

The archetype command

The first step to create your Maven-based custom webapp is running the archetype command. Change into the directory where you want to create the Maven project for the Magnolia webapp. In the directory, use a shell to run the following command:

mvn archetype:generate -DarchetypeGroupId=info.magnolia.maven.archetypes -DarchetypeArtifactId=magnolia-project-archetype -DarchetypeVersion=RELEASE

While the archetype script is running, Maven prompts you to supply values for a list of parameters. Some of them are Maven-specific, others concern only Magnolia. In some cases, Maven suggests a value. To accept it, enter RETURN or specify your own value and press RETURN.

Executing the archetype command is the very first step you always have to take irrespective of the webapp edition you wish to create (Community or Enterprise) and the approach you want follow (minimal or feature-rich). The parameters you specify in the prompts have no influence on the edition type or the approach.

Archetype parameters

These are the parameters Maven prompts you with in the order they appear:

ParemeterExample valueExplanation
groupId 1)com.exampleIt typically reflects the name or domain of your company or projects.
artifactId 1)custom-project-minimalProject-specific identifier.
Maven artifact version1.0-SNAPSHOTProject version. Typically, when creating a new project, use the value suggested, 1.0-SNAPSHOT.
packagecom.example

Package name for Java classes reflecting both your company (or domain) and the specific project.

(info) For this archetype, this parameter is not used, but you must provide a value. You can use the value proposed by the archetype script.

magnolia-bundle-version

6.2.35

The Magnolia version from which your custom project inherits. If you are unsure, use the latest released version (see releases).

This version is used in the dependencyManagement section of the created POM files. The section indirectly manages all the versions of the Magnolia modules which go into the webapp.

project-name custom-project-minimal

Project name.

In many cases it is reasonable to use the same value as in artifactId.

1) See also the Maven Guide to naming conventions on groupId, artifactId, and version.

After entering a project-name value, the archetype script lists all the values you have provided. Now you can:

  • Confirm your choice by pressing RETURN. Maven will generate the skeleton based on your parameters.

  • Escape the running archetype script by pressing CTRL+C. The script terminates, not creating anything. To start again, execute the archetype command as described above. 

If you have confirmed your choice of parameters, the script finishes the build with the BUILD SUCCESS message:

[INFO] ----------------------------------------------------------------------------
[INFO] Using following parameters for creating project from Archetype: magnolia-project-archetype:RELEASE
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: groupId, Value: com.example
[INFO] Parameter: artifactId, Value: custom-project-minimal
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: package, Value: com.example
[INFO] Parameter: packageInPathFormat, Value: com/example
[INFO] Parameter: magnolia-bundle-version, Value: 6.0
[INFO] Parameter: package, Value: com.example
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: groupId, Value: com.example
[INFO] Parameter: project-name, Value: custom-project-minimal
[INFO] Parameter: artifactId, Value: custom-project-minimal
[INFO] Parent element not overwritten in ~/dev/repo/magnolia/webapps/custom-project-minimal/custom-project-minimal-webapp/pom.xml
[INFO] project created from Archetype in dir: ~/dev/repo/magnolia/webapps/custom-project-minimal
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:43 h
[INFO] Finished at: 2019-01-11T12:59:47+07:00
[INFO] Final Memory: 12M/142M
[INFO] ------------------------------------------------------------------------

The webapp skeleton

Maven generates the following webapp skeleton:

custom-project-minimal/
├── custom-project-minimal-webapp
│   ├── pom.xml
│   └── src
└── pom.xml
  • Line 3: The webapp's POM file, defining the modules going into the webapp.
  • Line 4: The src directory, containing more subfolders. In Example 2, you add more resources to this directory.
  • Line 5: The parent (actually the root) POM file of the created project. This POM file manages the dependencies.

The POM files are the central pieces of the skeleton. Make sure you understand these files since you must adapt them in the examples to define the custom webapps.

Parent POM

The contents of the parent POM file:

custom-project-minimal/pom.xml
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><title>Log in - Magnolia Bitbucket</title><script>
window.WRM=window.WRM||{};window.WRM._unparsedData=window.WRM._unparsedData||{};window.WRM._unparsedErrors=window.WRM._unparsedErrors||{};
WRM._unparsedData["com.atlassian.bitbucket.server.bitbucket-webpack-INTERNAL:user-keyboard-shortcuts-enabled.data"]="true";
WRM._unparsedData["com.atlassian.analytics.analytics-client:programmatic-analytics-init.programmatic-analytics-data-provider"]="false";
WRM._unparsedData["com.atlassian.plugins.atlassian-plugins-webresource-plugin:context-path.context-path"]="\u0022\u0022";
WRM._unparsedData["com.atlassian.plugins.atlassian-clientside-extensions-runtime:runtime.atlassianDevMode"]="false";
WRM._unparsedData["com.atlassian.bitbucket.server.bitbucket-webpack-INTERNAL:date-format-preference.data"]="\u0022\u0022";
WRM._unparsedData["com.atlassian.analytics.analytics-client:policy-update-init.policy-update-data-provider"]="false";
WRM._unparsedData["com.atlassian.bitbucket.plugins.bitbucket-slack-server-integration-plugin:slack-link-error-resources.slack-link-error"]="{}";
WRM._unparsedData["com.atlassian.bitbucket.server.feature-wrm-data:user.time.zone.onboarding.data"]="true";
if(window.WRM._dataArrived)window.WRM._dataArrived();</script>
<link rel="stylesheet" href="/s/5f5fe464516a6c5b9c455381415ace6d-CDN/-2080960375/5e527f2/n1cn5w/aad85a899ed1c68cf9653e735ad438ff/_/download/contextbatch/css/_super/batch.css" data-wrm-key="_super" data-wrm-batch-type="context" media="all">
<link rel="stylesheet" href="/s/7364439700d47cabba95f7a8e86d29af-CDN/-2080960375/5e527f2/n1cn5w/6f9d8fea346063f8a3e3e0b41d4ef6db/_/download/contextbatch/css/bitbucket.page.login,-_super/batch.css" data-wrm-key="bitbucket.page.login,-_super" data-wrm-batch-type="context" media="all">
<link rel="stylesheet" href="/s/e3c5630b7437bc5c57d4bf22bb4c345e-CDN/-2080960375/5e527f2/n1cn5w/2dc868d2ee4aa15648ae7b05871d11ce/_/download/contextbatch/css/bitbucket.layout.focused,bitbucket.layout.base,atl.general,-_super/batch.css?slack-enabled=true" data-wrm-key="bitbucket.layout.focused,bitbucket.layout.base,atl.general,-_super" data-wrm-batch-type="context" media="all">
<script src="/s/23341bfef727890d6f6bfaa16c5d0b5c-CDN/-2080960375/5e527f2/n1cn5w/aad85a899ed1c68cf9653e735ad438ff/_/download/contextbatch/js/_super/batch.js?locale=en-US" data-wrm-key="_super" data-wrm-batch-type="context" data-initially-rendered></script>
<script src="/s/74e6e9fc9e664540e2f615c400d6cd56-CDN/-2080960375/5e527f2/n1cn5w/6f9d8fea346063f8a3e3e0b41d4ef6db/_/download/contextbatch/js/bitbucket.page.login,-_super/batch.js?locale=en-US" data-wrm-key="bitbucket.page.login,-_super" data-wrm-batch-type="context" data-initially-rendered></script>
<script src="/s/f2a79cf770d189c8097469c65fb4da87-CDN/-2080960375/5e527f2/n1cn5w/2dc868d2ee4aa15648ae7b05871d11ce/_/download/contextbatch/js/bitbucket.layout.focused,bitbucket.layout.base,atl.general,-_super/batch.js?locale=en-US&amp;slack-enabled=true" data-wrm-key="bitbucket.layout.focused,bitbucket.layout.base,atl.general,-_super" data-wrm-batch-type="context" data-initially-rendered></script>
<meta name="application-name" content="Bitbucket"><link rel="shortcut icon" type="image/x-icon" href="/s/-2080960375/5e527f2/n1cn5w/1.0/_/download/resources/com.atlassian.bitbucket.server.bitbucket-webpack-INTERNAL:favicon/favicon.ico" /><link rel="search" href="https://git.magnolia-cms.com/plugins/servlet/opensearch-descriptor" type="application/opensearchdescription+xml" title="Bitbucket code search"/></head><body class="aui-page-focused aui-page-focused-small aui-page-size-small bitbucket-theme user-login"><ul id="assistive-skip-links" class="assistive"><li><a href="#content">Skip to content</a></li></ul><div id="page"><!-- start #header --><header id="header" role="banner"><section class="notifications"></section><nav class="aui-header aui-dropdown2-trigger-group" aria-label="site"><div class="aui-header-inner"><div class="aui-header-before"><button class=" aui-dropdown2-trigger app-switcher-trigger aui-dropdown2-trigger-arrowless" aria-controls="app-switcher" aria-haspopup="true" role="button" data-aui-trigger href="#app-switcher"><span class="aui-icon aui-icon-small aui-iconfont-appswitcher">Linked Applications</span></button><div id="app-switcher" class="aui-dropdown2 aui-style-default" role="menu" hidden data-is-user-admin="false" data-is-switcher="true"><div class="app-switcher-loading">Loading&hellip;</div></div></div><div class="aui-header-primary"><span id="logo" class="aui-header-logo bitbucket-header-logo"><a href="https://git.magnolia-cms.com"><img src="/s/-2080960375/5e527f2/n1cn5w/1.0/_/download/resources/com.atlassian.bitbucket.server.bitbucket-webpack-INTERNAL:bitbucket-logo/images/logo/bitbucket.svg" alt="Bitbucket"/></a></span><ul class="aui-nav"></ul></div><div class="aui-header-secondary"><ul class="aui-nav"><li class=" help-link"title="Help"><a class=" aui-dropdown2-trigger aui-dropdown2-trigger-arrowless" aria-controls="com.atlassian.bitbucket.server.bitbucket-server-web-fragments-help-menu" aria-haspopup="true" role="button" tabindex="0" data-aui-trigger><span class="aui-icon aui-icon-small aui-icon-small aui-iconfont-question-circle">Help</span></a><div id="com.atlassian.bitbucket.server.bitbucket-server-web-fragments-help-menu" class="aui-dropdown2 aui-style-default" role="menu" hidden data-aui-dom-container="body"><div class="aui-dropdown2-section help-items-section"><ul class="aui-list-truncate" role="presentation"><li role="presentation"><a href="https://docs.atlassian.com/bitbucketserver/docs-089/Bitbucket+Data+Center+and+Server+documentation?utm_campaign=in-app-help&amp;amp;utm_medium=in-app-help&amp;amp;utm_source=stash" title="Go to the online documentation for Bitbucket" data-web-item-key="com.atlassian.bitbucket.server.bitbucket-server-web-fragments:general-help">Online help</a></li><li role="presentation"><a href="https://www.atlassian.com/git?utm_campaign=learn-git&amp;utm_medium=in-app-help&amp;utm_source=stash" title="Learn about Git commands &amp; workflows" data-web-item-key="com.atlassian.bitbucket.server.bitbucket-server-web-fragments:learn-git">Learn Git</a></li><li role="presentation"><a href="/getting-started"class="getting-started-page-link" title="Overview of Bitbucket features" data-web-item-key="com.atlassian.bitbucket.server.bitbucket-server-web-fragments:getting-started-page-help-link">Welcome to Bitbucket</a></li><li role="presentation"><a href="/#"class="keyboard-shortcut-link" title="Discover keyboard shortcuts in Bitbucket" data-web-item-key="com.atlassian.bitbucket.server.bitbucket-server-web-fragments:keyboard-shortcuts-help-link">Keyboard shortcuts</a></li><li role="presentation"><a href="https://go.atlassian.com/bitbucket-server-whats-new?utm_campaign=in-app-help&amp;utm_medium=in-app-help&amp;utm_source=stash" title="Learn about what&#39;s new in Bitbucket" data-web-item-key="com.atlassian.bitbucket.server.bitbucket-server-web-fragments:whats-new-link">What&#39;s new</a></li><li role="presentation"><a href="https://go.atlassian.com/bitbucket-server-community?utm_campaign=in-app-help&amp;utm_medium=in-app-help&amp;utm_source=stash" title="Explore the Atlassian community" data-web-item-key="com.atlassian.bitbucket.server.bitbucket-server-web-fragments:community-link">Community</a></li><li role="presentation"><a href="/about" title="About Bitbucket" data-web-item-key="com.atlassian.bitbucket.server.bitbucket-server-web-fragments:about">About</a></li></ul></div></div></li><li class=" alerts-menu"title="View system alerts"><a href="#alerts" id="alerts-trigger"class="alerts-menu" title="View system alerts" data-web-item-key="com.atlassian.bitbucket.server.bitbucket-server-web-fragments:global-alerts-menu-item">Alerts</a></li></ul></div></div> <!-- End .aui-header-inner --></nav> <!-- End .aui-header --></header><!-- End #header --><!-- Start #content --><section id="content" role="main" tabindex="-1" data-timezone="-120" ><div class="aui-page-panel content-body" ><div class="aui-page-panel-inner"><main role="main" id="main" class="aui-page-panel-content" ><h2>Log in</h2><form class="aui top-label prevent-double-submit " action="/j_atl_security_check" method="post" accept-charset="UTF-8"><div class="field-group"><label for="j_username" >Username</label><input class="text long-field" type="text" id="j_username"  name="j_username"  autofocus accesskey="u"/></div><div class="field-group"><label for="j_password" >Password</label><input class="text long-field" type="password" id="j_password"  name="j_password"  accesskey="p"/></div><div class="aui-group"><fieldset class="group checkbox"><div class="checkbox"><input class="checkbox" type="checkbox" id="_atl_remember_me"  name="_atl_remember_me"  checked="checked"  accesskey="r"/><label for="_atl_remember_me" >Keep me logged in</label></div></fieldset></div><div class="aui-group"><input name="next" type="hidden" value="/projects/DOCUMENTATION/repos/custom-project-minimal/raw/pom.xml?at=master"/><input name="queryString" type="hidden" value="next=%2Fprojects%2FDOCUMENTATION%2Frepos%2Fcustom-project-minimal%2Fraw%2Fpom.xml%3Fat%3Dmaster"/><input class="aui-button aui-button-primary" type="submit" id="submit"  name="submit"  value="Log in" accesskey="s"/><a id="forgot" class="aui-button aui-button-link"  name="forgot" href="/passwordreset" autocomplete="off" tabindex="0">Unable to access your account?</a></div></form></main></div></div></section><!-- End #content --><!-- Start #footer --><footer id="footer" role="contentinfo"><section class="notifications"></section><section class="footer-body"><ul><li data-key="footer.license.message">Git repository management for enterprise teams powered by <a href="https://www.atlassian.com/software/bitbucket/">Atlassian Bitbucket</a></li></ul><ul><li>Atlassian Bitbucket <span title="5e527f230b23d8b06680fcead51b9e55061f12eb" id="product-version" data-commitid="5e527f230b23d8b06680fcead51b9e55061f12eb" data-system-build-number="5e527f2"> v8.9.0</span></li><li data-key="footer.links.documentation"><a href="https://docs.atlassian.com/bitbucketserver/docs-089/Bitbucket+Data+Center+and+Server+documentation?utm_campaign=in-app-help&amp;utm_medium=in-app-help&amp;utm_source=stash" target="_blank">Documentation</a></li><li data-key="footer.links.jac"><a href="https://jira.atlassian.com/browse/BSERV?utm_campaign=in-app-help&amp;utm_medium=in-app-help&amp;utm_source=stash" target="_blank">Request a feature</a></li><li data-key="footer.links.about"><a href="/about">About</a></li><li data-key="footer.links.contact.atlassian"><a href="https://www.atlassian.com/company/contact?utm_campaign=in-app-help&amp;utm_medium=in-app-help&amp;utm_source=stash" target="_blank">Contact Atlassian</a></li></ul><div id="footer-logo"><a href="https://www.atlassian.com/" target="_blank">Atlassian</a></div></section></footer><!-- End #footer --></div><script>require('bitbucket/internal/layout/base/base').onReady(null, "Magnolia Bitbucket" ); require('bitbucket/internal/widget/keyboard-shortcuts/keyboard-shortcuts').onReady();</script><script type="text/javascript">require('bitbucket/internal/page/login/login').onReady();</script></body></html>
Depending on the requirements of your project, the properties and the dependencyManagement sections may need some adjustments.

Properties

The properties section is where you define values such as versions. You can use the section in both the parent POM and the webapp POM.

Best practice

Use the properties section to define versions. The section may the serve as a central part for organizing all versions required by your project.
On lines 10-13 in the file embedded above, for example, the archetype adds the magnoliaBundleVersion property. 

Dependency management

In the dependencyManagement section, you define the artifact dependencies that you also add to the module in the webapp POM. See lines 22-47 in the file embedded above.

In the skeleton,Option A and Option B were created, the latter as a comment.

  • Use the Option A to inherit dependency management for a Magnolia Community Edition (CE) webapp. 
    Have a look at the parent POM of the CE bundle to understand what exactly you inherit with Option A.

  • Use the Option B to inherit dependency management for a Magnolia Enterprise Edition (EE) webapp.
    Importing the EE dependency management section also indirectly imports the CE dependency management.
    Have a look at the parent POM of the EE bundle to understand what exactly you inherit with Option B. To access the parent POM of the EE bundle on Git, you need EE credentials.

Also, use the  dependencyManagement section to define the versions of other modules which you want to add to the webapp.

Webapp POM

The contents of the webapp POM file:

custom-project-minimal/custom-project-minimal-webapp/pom.xml
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><title>Log in - Magnolia Bitbucket</title><script>
window.WRM=window.WRM||{};window.WRM._unparsedData=window.WRM._unparsedData||{};window.WRM._unparsedErrors=window.WRM._unparsedErrors||{};
WRM._unparsedData["com.atlassian.bitbucket.server.bitbucket-webpack-INTERNAL:user-keyboard-shortcuts-enabled.data"]="true";
WRM._unparsedData["com.atlassian.analytics.analytics-client:programmatic-analytics-init.programmatic-analytics-data-provider"]="false";
WRM._unparsedData["com.atlassian.plugins.atlassian-plugins-webresource-plugin:context-path.context-path"]="\u0022\u0022";
WRM._unparsedData["com.atlassian.plugins.atlassian-clientside-extensions-runtime:runtime.atlassianDevMode"]="false";
WRM._unparsedData["com.atlassian.bitbucket.server.bitbucket-webpack-INTERNAL:date-format-preference.data"]="\u0022\u0022";
WRM._unparsedData["com.atlassian.analytics.analytics-client:policy-update-init.policy-update-data-provider"]="false";
WRM._unparsedData["com.atlassian.bitbucket.plugins.bitbucket-slack-server-integration-plugin:slack-link-error-resources.slack-link-error"]="{}";
WRM._unparsedData["com.atlassian.bitbucket.server.feature-wrm-data:user.time.zone.onboarding.data"]="true";
if(window.WRM._dataArrived)window.WRM._dataArrived();</script>
<link rel="stylesheet" href="/s/5f5fe464516a6c5b9c455381415ace6d-CDN/-2080960375/5e527f2/n1cn5w/aad85a899ed1c68cf9653e735ad438ff/_/download/contextbatch/css/_super/batch.css" data-wrm-key="_super" data-wrm-batch-type="context" media="all">
<link rel="stylesheet" href="/s/7364439700d47cabba95f7a8e86d29af-CDN/-2080960375/5e527f2/n1cn5w/6f9d8fea346063f8a3e3e0b41d4ef6db/_/download/contextbatch/css/bitbucket.page.login,-_super/batch.css" data-wrm-key="bitbucket.page.login,-_super" data-wrm-batch-type="context" media="all">
<link rel="stylesheet" href="/s/e3c5630b7437bc5c57d4bf22bb4c345e-CDN/-2080960375/5e527f2/n1cn5w/2dc868d2ee4aa15648ae7b05871d11ce/_/download/contextbatch/css/bitbucket.layout.focused,bitbucket.layout.base,atl.general,-_super/batch.css?slack-enabled=true" data-wrm-key="bitbucket.layout.focused,bitbucket.layout.base,atl.general,-_super" data-wrm-batch-type="context" media="all">
<script src="/s/23341bfef727890d6f6bfaa16c5d0b5c-CDN/-2080960375/5e527f2/n1cn5w/aad85a899ed1c68cf9653e735ad438ff/_/download/contextbatch/js/_super/batch.js?locale=en-US" data-wrm-key="_super" data-wrm-batch-type="context" data-initially-rendered></script>
<script src="/s/74e6e9fc9e664540e2f615c400d6cd56-CDN/-2080960375/5e527f2/n1cn5w/6f9d8fea346063f8a3e3e0b41d4ef6db/_/download/contextbatch/js/bitbucket.page.login,-_super/batch.js?locale=en-US" data-wrm-key="bitbucket.page.login,-_super" data-wrm-batch-type="context" data-initially-rendered></script>
<script src="/s/f2a79cf770d189c8097469c65fb4da87-CDN/-2080960375/5e527f2/n1cn5w/2dc868d2ee4aa15648ae7b05871d11ce/_/download/contextbatch/js/bitbucket.layout.focused,bitbucket.layout.base,atl.general,-_super/batch.js?locale=en-US&amp;slack-enabled=true" data-wrm-key="bitbucket.layout.focused,bitbucket.layout.base,atl.general,-_super" data-wrm-batch-type="context" data-initially-rendered></script>
<meta name="application-name" content="Bitbucket"><link rel="shortcut icon" type="image/x-icon" href="/s/-2080960375/5e527f2/n1cn5w/1.0/_/download/resources/com.atlassian.bitbucket.server.bitbucket-webpack-INTERNAL:favicon/favicon.ico" /><link rel="search" href="https://git.magnolia-cms.com/plugins/servlet/opensearch-descriptor" type="application/opensearchdescription+xml" title="Bitbucket code search"/></head><body class="aui-page-focused aui-page-focused-small aui-page-size-small bitbucket-theme user-login"><ul id="assistive-skip-links" class="assistive"><li><a href="#content">Skip to content</a></li></ul><div id="page"><!-- start #header --><header id="header" role="banner"><section class="notifications"></section><nav class="aui-header aui-dropdown2-trigger-group" aria-label="site"><div class="aui-header-inner"><div class="aui-header-before"><button class=" aui-dropdown2-trigger app-switcher-trigger aui-dropdown2-trigger-arrowless" aria-controls="app-switcher" aria-haspopup="true" role="button" data-aui-trigger href="#app-switcher"><span class="aui-icon aui-icon-small aui-iconfont-appswitcher">Linked Applications</span></button><div id="app-switcher" class="aui-dropdown2 aui-style-default" role="menu" hidden data-is-user-admin="false" data-is-switcher="true"><div class="app-switcher-loading">Loading&hellip;</div></div></div><div class="aui-header-primary"><span id="logo" class="aui-header-logo bitbucket-header-logo"><a href="https://git.magnolia-cms.com"><img src="/s/-2080960375/5e527f2/n1cn5w/1.0/_/download/resources/com.atlassian.bitbucket.server.bitbucket-webpack-INTERNAL:bitbucket-logo/images/logo/bitbucket.svg" alt="Bitbucket"/></a></span><ul class="aui-nav"></ul></div><div class="aui-header-secondary"><ul class="aui-nav"><li class=" help-link"title="Help"><a class=" aui-dropdown2-trigger aui-dropdown2-trigger-arrowless" aria-controls="com.atlassian.bitbucket.server.bitbucket-server-web-fragments-help-menu" aria-haspopup="true" role="button" tabindex="0" data-aui-trigger><span class="aui-icon aui-icon-small aui-icon-small aui-iconfont-question-circle">Help</span></a><div id="com.atlassian.bitbucket.server.bitbucket-server-web-fragments-help-menu" class="aui-dropdown2 aui-style-default" role="menu" hidden data-aui-dom-container="body"><div class="aui-dropdown2-section help-items-section"><ul class="aui-list-truncate" role="presentation"><li role="presentation"><a href="https://docs.atlassian.com/bitbucketserver/docs-089/Bitbucket+Data+Center+and+Server+documentation?utm_campaign=in-app-help&amp;amp;utm_medium=in-app-help&amp;amp;utm_source=stash" title="Go to the online documentation for Bitbucket" data-web-item-key="com.atlassian.bitbucket.server.bitbucket-server-web-fragments:general-help">Online help</a></li><li role="presentation"><a href="https://www.atlassian.com/git?utm_campaign=learn-git&amp;utm_medium=in-app-help&amp;utm_source=stash" title="Learn about Git commands &amp; workflows" data-web-item-key="com.atlassian.bitbucket.server.bitbucket-server-web-fragments:learn-git">Learn Git</a></li><li role="presentation"><a href="/getting-started"class="getting-started-page-link" title="Overview of Bitbucket features" data-web-item-key="com.atlassian.bitbucket.server.bitbucket-server-web-fragments:getting-started-page-help-link">Welcome to Bitbucket</a></li><li role="presentation"><a href="/#"class="keyboard-shortcut-link" title="Discover keyboard shortcuts in Bitbucket" data-web-item-key="com.atlassian.bitbucket.server.bitbucket-server-web-fragments:keyboard-shortcuts-help-link">Keyboard shortcuts</a></li><li role="presentation"><a href="https://go.atlassian.com/bitbucket-server-whats-new?utm_campaign=in-app-help&amp;utm_medium=in-app-help&amp;utm_source=stash" title="Learn about what&#39;s new in Bitbucket" data-web-item-key="com.atlassian.bitbucket.server.bitbucket-server-web-fragments:whats-new-link">What&#39;s new</a></li><li role="presentation"><a href="https://go.atlassian.com/bitbucket-server-community?utm_campaign=in-app-help&amp;utm_medium=in-app-help&amp;utm_source=stash" title="Explore the Atlassian community" data-web-item-key="com.atlassian.bitbucket.server.bitbucket-server-web-fragments:community-link">Community</a></li><li role="presentation"><a href="/about" title="About Bitbucket" data-web-item-key="com.atlassian.bitbucket.server.bitbucket-server-web-fragments:about">About</a></li></ul></div></div></li><li class=" alerts-menu"title="View system alerts"><a href="#alerts" id="alerts-trigger"class="alerts-menu" title="View system alerts" data-web-item-key="com.atlassian.bitbucket.server.bitbucket-server-web-fragments:global-alerts-menu-item">Alerts</a></li></ul></div></div> <!-- End .aui-header-inner --></nav> <!-- End .aui-header --></header><!-- End #header --><!-- Start #content --><section id="content" role="main" tabindex="-1" data-timezone="-120" ><div class="aui-page-panel content-body" ><div class="aui-page-panel-inner"><main role="main" id="main" class="aui-page-panel-content" ><h2>Log in</h2><form class="aui top-label prevent-double-submit " action="/j_atl_security_check" method="post" accept-charset="UTF-8"><div class="field-group"><label for="j_username" >Username</label><input class="text long-field" type="text" id="j_username"  name="j_username"  autofocus accesskey="u"/></div><div class="field-group"><label for="j_password" >Password</label><input class="text long-field" type="password" id="j_password"  name="j_password"  accesskey="p"/></div><div class="aui-group"><fieldset class="group checkbox"><div class="checkbox"><input class="checkbox" type="checkbox" id="_atl_remember_me"  name="_atl_remember_me"  checked="checked"  accesskey="r"/><label for="_atl_remember_me" >Keep me logged in</label></div></fieldset></div><div class="aui-group"><input name="next" type="hidden" value="/projects/DOCUMENTATION/repos/custom-project-minimal/raw/custom-project-minimal-webapp/pom.xml?at=master"/><input name="queryString" type="hidden" value="next=%2Fprojects%2FDOCUMENTATION%2Frepos%2Fcustom-project-minimal%2Fraw%2Fcustom-project-minimal-webapp%2Fpom.xml%3Fat%3Dmaster"/><input class="aui-button aui-button-primary" type="submit" id="submit"  name="submit"  value="Log in" accesskey="s"/><a id="forgot" class="aui-button aui-button-link"  name="forgot" href="/passwordreset" autocomplete="off" tabindex="0">Unable to access your account?</a></div></form></main></div></div></section><!-- End #content --><!-- Start #footer --><footer id="footer" role="contentinfo"><section class="notifications"></section><section class="footer-body"><ul><li data-key="footer.license.message">Git repository management for enterprise teams powered by <a href="https://www.atlassian.com/software/bitbucket/">Atlassian Bitbucket</a></li></ul><ul><li>Atlassian Bitbucket <span title="5e527f230b23d8b06680fcead51b9e55061f12eb" id="product-version" data-commitid="5e527f230b23d8b06680fcead51b9e55061f12eb" data-system-build-number="5e527f2"> v8.9.0</span></li><li data-key="footer.links.documentation"><a href="https://docs.atlassian.com/bitbucketserver/docs-089/Bitbucket+Data+Center+and+Server+documentation?utm_campaign=in-app-help&amp;utm_medium=in-app-help&amp;utm_source=stash" target="_blank">Documentation</a></li><li data-key="footer.links.jac"><a href="https://jira.atlassian.com/browse/BSERV?utm_campaign=in-app-help&amp;utm_medium=in-app-help&amp;utm_source=stash" target="_blank">Request a feature</a></li><li data-key="footer.links.about"><a href="/about">About</a></li><li data-key="footer.links.contact.atlassian"><a href="https://www.atlassian.com/company/contact?utm_campaign=in-app-help&amp;utm_medium=in-app-help&amp;utm_source=stash" target="_blank">Contact Atlassian</a></li></ul><div id="footer-logo"><a href="https://www.atlassian.com/" target="_blank">Atlassian</a></div></section></footer><!-- End #footer --></div><script>require('bitbucket/internal/layout/base/base').onReady(null, "Magnolia Bitbucket" ); require('bitbucket/internal/widget/keyboard-shortcuts/keyboard-shortcuts').onReady();</script><script type="text/javascript">require('bitbucket/internal/page/login/login').onReady();</script></body></html>

Dependencies

Finally, in the dependencies section of the webapp POM, you assemble the modules which should be part of the webapp. Since you are using a preconfigured Magnolia webapp as the base, the Magnolia archetype creates and adds the following options to the webapp POM (lines 13-83 above):

  • magnolia-empty-webapp
  • magnolia-community-webapp
  • magnolia-enterprise-standard-webapp
  • magnolia-enterprise-pro-webapp

Each of these options has a dependency to two artifact types  –  pom and war.

Besides adding an existing webapp, you typically also add other dependencies to single modules.

Examples

For examples of creating custom webapps with Maven, see the following pages:

#trackbackRdf ($trackbackUtils.getContentIdentifier($page) $page.title $trackbackUtils.getPingUrl($page))
  • No labels