Maven setup

Maven is a tool for managing project dependencies and building your Magnolia project.

This page describes how to configure Maven to download Magnolia modules and webapps from our Nexus server, with appropriate access credentials.

Install maven

Download and Install Maven. In order to verify Maven has been installed correctly:

  1. Open a terminal or a shell.

  2. Issue the command mvn -v. The command should produce an output similar to this:

    mvn -v
    
    Apache Maven 3.9.11 (3e54c93...d3d825b)
    Maven home: /opt/apache-maven-3.9.11
    Java version: <JAVA_VERSION>, vendor: Eclipse Adoptium, runtime: path/to/install
    Default locale: fr_FR, platform encoding: UTF-8
    OS name: "<OPERATING_SYSTEM>"
    Maven keeps your user configuration and local repository under the ${user.home}/.m2/ directory. For more details, see Configuring Maven.

Set up Magnolia repositories

  • DX Core

  • Community

For DX Core projects, add the following repository to your project POM (or Maven settings profile), and follow the next sections to set up authentication.

<repositories>
  <repository>
    <id>magnolia.nexus.enterprise</id>
    <url>https://nexus.magnolia-cms.com/repository/enterprise</url>
  </repository>
</repositories>

This also applies to Community Edition releases in maintenance mode.

For Community Edition projects, use these repositories:

<repositories>
  <repository>
    <id>magnolia.nexus.public</id>
    <url>https://nexus.magnolia-cms.com/repository/public</url>
  </repository>
   <repository>
    <id>vaadin-addons</id>
    <url>https://maven.vaadin.com/vaadin-addons/</url>
  </repository>
 </repositories>
Magnolia provides additional regional repositories for US and APAC. Choose the appropriate regional URL for your environment.

We recommend you create a master password. However, this is not mandatory.

For more details, see Maven’s Password Encryption.
  1. Run the following command.

    mvn --encrypt-master-password

    This command produces an encrypted version of the password similar to the example below:

    {jSMOWnoPFgsHVpMvz5VrIt5kRbzGpI8u+9EF1iFQyJQ=}
  2. Store the password in ~/.m2/settings-security.xml.

    <settingsSecurity>
      <master>{jSMOWnoPFgsHVpMvz5VrIt5kRbzGpI8u+9EF1iFQyJQ=}</master>
    </settingsSecurity>

Set up credentials in Maven settings

To set up or update your credentials for Maven:

  1. Log into the chosen regional Magnolia Nexus with SSO.

  2. Access your User Token details from the user menu.
    See more: Working with Your User Profile

  3. If you have created a master password, encrypt your user token pass code:

    mvn --encrypt-password ${userTokenPassCode}
  4. Finally, store the token in the format shown here.

    <server>
      <id>magnolia.nexus.enterprise</id> (1)
      <!-- Token, not actual username / password -->
      <username>{userTokenNameCode}</username> (2)
      <password>{userTokenPassCode}</password> (3)
    </server>
    1 The Magnolia enterprise Nexus repository. The id must match the repository id in your project POM or 'magnolia-repositories' profile in maven settings.
    2 Your name code user token from Nexus.
    3 Your pass code user token from Nexus. You may use your encrypted pass code token here.

Regional Magnolia repositories

Magnolia provides regional repositories for better performance:

Choose the appropriate Magnolia Nexus regional URL for your environment.

Using Magnolia Maven archetypes

You need Maven to generate Magnolia project archetypes. To do so, add the following to your Maven settings.

settings.xml
<profiles>
  <profile>
    <id>magnolia-repositories</id>
    <activation>
      <activeByDefault>true</activeByDefault>
    </activation>
    <repositories>
      <!-- required for Magnolia Maven archetypes -->
      <repository>
        <id>magnolia.nexus.public</id>
        <url>https://nexus.magnolia-cms.com/repository/public</url>
      </repository>
    </repositories>
  </profile>
</profiles>
For more details, see Maven Archetypes and repositories.
Feedback

DX Core

×

Location

This widget lets you know where you are on the docs site.

You are currently perusing through the DX Core docs.

Main doc sections

DX Core Headless PaaS Legacy Cloud Incubator modules