Skip to end of metadata
Go to start of metadata

This page describes how to install and setup Maven to get access to the Magnolia Maven repository (https://nexus.magnolia-cms.com/)  for users with Community Edition (CE) or Enterprise Edition (EE) license.


Prerequisite

Make sure you have installed a Java JDK SE (Java Development Kit Standard Edition) version 1.6 or higher. Currently we recommend 1.7.

Install Maven version 3

We highly recommend to use Maven version 3.2.3.

Download Maven from Apache Maven ProjectDownload a package you can work with (.zip or .tar.gz) on your OS.
For OS specific installations see Apache Maven Project. If you follow the OS specific instructions, you will set some environment variables.

Verify the Maven version

When you have finished the installation, verify that Maven is set correctly:

  1. Open a terminal or a shell.
  2. Issue the command: mvn -version

You should see something like that:

The .m2 directory

As soon as you start using Maven, Maven will use a local repository. This repository as well as settings and properties files are located within the .m2 directory.
The location of the .m2 directory depends on your OS.

Mac/Users/<your-username>/.m2
WindowsC:\Documents and Settings\<your-username>\.m2
or
C:\Users\<your-username>\.m2 
generally~/.m2

Maven will create the .m2 directory the first time when it is required.

Set up for CE users

If you are using an EE license, skip this section

When using a CE license you only have access to public resources. 
All you have to do is to add the public nexus repository either to the pom file of your projects or to your maven settings.xml

~/.m2/settings.xml

Init maven for CE users

If you have no settings.xml, you can init Maven with a Maven command which will create the settings.xml including the settings for nexus.
Execute the following:

Maven will ask you:

  • For a username and a password; enter anonymous for both.
  • To select a Template: choose magnolia-community-public
That's all. At the end of the process, Maven tells you where the new created settings.xml has been saved:

 

The settings.xml is saved within your ~/.m2/ directory.

Setup for EE users

In this section we will explain what must be done to setup your Maven settings which allows you to access restricted data. As an EE user you have received credentials - a username and a password.
First you should verify your credentials. As a second step we recommend to prepare Maven to let it use encrypted credentials, finally you are going to run a Maven command to setup the settings.xml (even if you already have one).

Verify username and password 

Magnolia has provided you a username and password which gives you access to several resources, theses credentials also will be used by Maven to download resources which are restricted. Verify now your credentials:

Go to https://nexus.magnolia-cms.com/ with the browser of your choice and try to login. 
If your credentials are correct, the login works fine and your username will be displayed on the top right corner of the Magnolia nexus page.

   

Enable password encryption

Per default credentials for a repository are stored in the settings.xml file in plain text. However, Maven supports password encryption. We highly recommend that you encrypt your password.

Use a shell and execute the following command:

Enter "master Maven password" when prompted for.
Maven creates the file ~/.m2/settings-security.xml. These security settings will be used to encrypt your credentials for the repositories.

Note that the so called "master Maven password" has nothing to do with the nexus credentials, just choose one. The master Maven password will be used to encrypt credentials for specific repositories like Magnolia nexus.
The first time when trying to access data from a repository Maven will ask you for your credentials for this repository (in our case for Magnolia Nexus). Maven creates encrypted token for both username and password and adds these tokens into the settings.xml (instead of plain text credentials).

Init maven for EE users

Now we setup maven with the settings for Magnolia nexus. During this process the ~/.m2/settings.xml will be created. 
If you already have a settings.xml, Maven creates a backup of the old version. You might have to manually merge the newly created settings.xml containing Magnolia specific settings with your existing custom settings. If you need help, ask at the forum.  

Switch to your shell and add the following Maven command:

Maven will ask you to prompt your Nexus credentials. Enter username and password which was provided to you by Magnolia.

Now you are ready to download resources from Nexus which are restricted. 

Test the Maven Nexus settings

A simple way to test your settings: Try to build a project with Maven which is dependent on a Magnolia Enterprise module. You should be able to build it with the -U option.
If you do not have such a project, clone the documentation-check-maven-settings from our git repository and build it with Maven.

 Click here to expand to get the details about fetching documentation-check-maven-settings and building it to test the maven settings

Open a terminal, change to a temporary directory and clone the documentation-check-maven-settings module from magnolia git:

Now change into the cloned module and build the project with the -U option:

Maven will print out all the downloaded artifacts. At the end it should display the "BUILD SUCCESS" message:

Troubleshooting

You can login on the wiki, but your credentials seem to be rejected by the Nexus template download

Some characters such as the euro "€" symbol in passwords cause issues. Try changing your password and see if that helps. If this doesn't help, ask for help on the Magnolia forum.

3rd party repositories

Depending on the network infrastructure you work with, you probably have to add further repositories to your settings.xml. 

Vaadin repository

If you failed to build the project above because Maven was not able to download a Vaadin artifact, add the following snippet to your settings.xml.

You have your own Maven repository

If you have your own Maven repository, these are the repositories you can mirror.

 Remarks: 

  1. These repositories will eventually be synched to the Maven Central Repository so watch for changes to this page.
  2. You need a Magnolia account to access these repositories. Please get a "robots" account with us.
  3. This will also possibly, eventually, be synched to the Maven Central Repository - contains a few third party artifact we customized and released ourselves (for example a bugfix release of OpenWFE) - we're working on making this obsolete, i.e use dependencies which are available on the Maven Central Repository.
  4. A few artifacts Magnolia uses which are not available on the Maven Central Repository.
Labels
  1. Aug 11, 2010

    In maven-settings-template-enterprise.xml please change the following:

    <server>

    <id>magnolia.nexus.enterprise</id>

    </server>

    <repository>

    <id>magnolia.nexus.enterprise</id>

    <url>http://nexus.magnolia-cms.com/content/repositories/magnolia.enterprise.releases</url>

    1. Aug 11, 2010

      Server id is fixed; repo url should still point to the group - well, that's up to you, but using the group, you get releases, snapshots and 3rd party artifacts (those which are not available on central). As mentioned above, if you have your own Maven proxy, then you should proxy our repositories instead, indeed.

  2. Aug 13, 2010

    There was a typo in the previous version of the enterprise settings template, please update !

    1. May 27, 2013

      If you use your own repository manager and proxy all your request through it, I'd suggest to do that, yeah. If on the other hand you're specifying repos in your local settings.xml, just use http://nexus.magnolia-cms.com/content/groups/public. Using the template as per http://documentation.magnolia-cms.com/developing/dev-environment/maven/maven-init.html could help if you don't have a custom settings.xml. OTOH, the archetype should have produced a module that has the appropriate <repository> item(s) in the generated pom.xml.

  3. Aug 06, 2014

    Please note that nexus should be accessed via https only due to man in the middle attacks.  Http access will shortly be switched off.