You are here: Foswiki>IN Web>Services>Buildsystem>Maven (08 Feb 2023, AndreasSchaller)Edit Attach


A preconfigured version of maven is installed on the development servers. Just type mvn. If you want to take a look at the configuration /opt/maven/conf.

Maven and Eclipse

Maven Integration for Eclipse Plug-In (m2e)

On the acc7 cluster (asl74x) m2e is preinstalled with the provided eclipse version.

Configuring the Maven instance used in Eclipse

  • Path to the Maven installation:
    In the menu go to Window -> Preferences -> Maven -> Installations
    here you press the "Add..." button and choose the maven setup located at "/opt/maven" (for acc8 and acc9 /usr/share/maven). After that you can close the window by pressing "Ok".
  • global maven settings:
    In the menu go to Window -> Preferences -> Maven -> User Settings
    Global Settings should point to /opt/maven/conf/settings.xml (for acc8 /etc/maven/settings.xml)
  • Configure the BEL archetypes repository:
    Maven: Window -> Preferences -> Maven -> Archetypes -> Add remote catalog: "GSI catalog":
  • Configure the editing of pom.xml files (optional):
    Maven: Window -> Preferences -> Maven -> User Interface -> enable "open xml page"
  • Disable index files:
    • Window -> Preferences -> Maven -> uncheck "download repository index updates on startup"
    • for each repository in the "Window -> Show View -> Other -> Maven repository" view right mouse click and check "Disable Index Details"

see also AppHowToEclipseConfiguration


See also ArtifactRepository.

If you get a peer not authenticated Error, your java installation is missing the acc-ca Zertificate.


To enable authentication (required to deploy artifacts, or access the SCM/Subversion) you need to manually configure your maven password settings. See for the full guide.

Please make absolutely sure you checked the file permissions on $HOME/.m2/settings-security.xml and understand the security issues resulting from it.

generate a random master password
mvn --encrypt-master-password $(openssl rand -base64 32)

store password in $HOME/.m2/settings-security.xml

make sure permissions are good
chmod 600 $HOME/.m2/settings-security.xml

create an encrypted version of your ACC password
mvn --encrypt-password
# you will be prompted, do NOT pass it as parameter

store encrypted in $HOME/.m2/settings.xml
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns=""

Useful Maven Commands (Cheat Sheet)

Update parent version of all child modules

Modify parent pom. Execute mvn versions:update-child-modules

Danch sollten in allen children pom's die Nummern auch erhöht worden sein.

Create a PDF or PNG of the dependencies of a project

Create a .DOT file using: mvn org.apache.maven.plugins:maven-dependency-plugin:2.3:tree -DoutputType=dot

To convert it to PDF: dot -Tpdf -Grankdir=LR -o dependency.pdf

To convert it to PNG: dot -Tpng -Grankdir=LR -o dependency.png

Installing 3rdParty jar in local Repository

mvn install:install-file -Dfile=foo.jar -DgroupId=org.foosoft -DartifactId=foo -Dversion=1.2.3 -Dpackaging=jar

Deploy single file

mvn deploy:deploy-file -Dfile=$FILE -DrepositoryId=csco-snapshot -DartifactId=$ARTIFACTID -DgroupId=$GROUPID -Dversion=$VERSION-SNAPSHOT -Durl=

Checking for new dependency updates

mvn versions:display-dependency-updates

[INFO] The following dependencies in Dependencies are using the newest version:
[INFO]   com.fasterxml.jackson.core:jackson-databind .................... 2.1.3
[INFO] The following dependencies in Dependencies have newer versions:
[INFO]   cmmnbuild:lsa-dbaccess ................................ 7.1.2 -> 7.2.1
[INFO]   org.hibernate:hibernate-core ................ 4.1.9.Final -> 4.2.0.CR1

Minimal pom.xml

mvn archetype:create

Create a project from a GSI-AP Java Project Template

mvn -DarchetypeArtifactId=csco-java-bundle-template archetype:generate

Create a simple maven java "Hello World!" project. Just a basic pom.xml, src and test folder

mvn -DarchetypeArtifactId=maven-archetype-quickstart archetype:generate

Build in parallel on several available cores

mvn -TC1 compile

Build only one module of a reactor

and all the dependencies this module requires
mvn compile -pl path/to/module -am

Multi Module Reactor build issues

In a multi module reactor project dependency resolution does not always happen as expected. mvn compile correctly resolves dependencies within the reactor. But mvn package or mvn dependency:tree resolve against repoistories (local or remote). Running mvn install to build, package and install to the local repository before packaging or checking dependency is necessary.

Fetching dependencies of a project and installing it in another local repository (linux assumed)

Add the following plugin to the plugin section of the pom.xml/project you want to fetch the dependencies for:

            <!-- this will put a directory structure in target/dependency 
                 that can be used as a maven repository. Do not use this
                 together with prependGroupId -->
            <!-- useRepositoryLayout>true</useRepositoryLayout -->

Change into the products directory and type:

mvn validate
zip target/dependency/*

Now copy the to the desired user that wants to install the artifacts in his repository (we suggest to create some kind of temporary directory for this). Login as the user, change to the (temporary) directory with the zip file and type:

cd target/dependency
for POM in *.pom; do JAR=$(basename ${POM} ".pom").jar; if [ -f ${JAR} ]; then mvn install:install-file -Dfile=${JAR} -DpomFile=${POM}; else mvn install:install-file -Dfile=${POM} -DpomFile=${POM}; fi; done;

Maven Quick Reference Card

-- ChristophHandel - 02 Feb 2012
Topic revision: r44 - 08 Feb 2023, AndreasSchaller
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback