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:

    example
    mvn -v
    
    Apache Maven 3.9.1 (2e17850...cc58f8)
    Maven home: /usr/local/apache-maven-3.9.1
    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

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

DX Core
<repositories>
  <repository>
    <id>magnolia.nexus.enterprise</id>
    <url>https://nexus.magnolia-cms.com/repository/enterprise</url>
  </repository>
</repositories>
Community edition
<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>

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 Nexus with your regular credentials.

  2. Go to your profile. This is typically in the top corner with your username.

  3. Select User Token from the menu.

  4. Click Access user token.

    This prompts you to log in again. Upon successful login, your user tokens are displayed.

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

    mvn --encrypt-password ${userTokenPassCode}
  6. 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.

Using Magnolia Maven archetypes

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

<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
6.3 beta
X

Magnolia 6.3 beta

Magnolia 6.3 is in beta. We are updating docs based on development and feedback. Consider the 6.3 docs currently in a state of progress and not final.

We are working on some 6.3-beta known issues during this phase.