Maven Install

Reference

  • Follows tutorial with specific notes for my environments.
  • Covers the installation of the command-line version of Maven.
  • Eclipse installation is mentioned below, but the steps are not listed here, see M2Eclipse Install.

Steps

Install

With notes for upgrades.

Under Windows XP

  • Check the Java version. 1.5 is recommended since other pieces will depend on 1.5.
  • Download Site
  • Version 3.0 is available, but I'm going to continue with 2.2.1 until 3.0 settles out a bit.
  • Installed to C:\dev\apache-maven-2.1.0 (2.2.1 for ThinkPad environment)
  • Added M2_HOME environment variable as a system-wide environment variable.
  • Added %M2_HOME%\bin to the PATH.
  • Found that the /bin/sh isn't available in my copy of cygwin, so I'm linking bash.exe to sh.exe.
  • Found that the JAVA_HOME was set to a 1.4 version of the JDK on ThinkPad, so setting it within the shell to point to 1.6 version: JAVA_HOME=C:\\Sun\\SDK\\jdk

Upgrade Notes

  • Need to copy over the <inst_dir>/conf/settings.xml over to the new installation.

Under Gentoo Linux

  • I've emerged dev-java/maven-bin which is at version 2.2.1.
  • The executable is under /usr/bin/mvn-2.2 so I created a softlink from mvn to mvn-2.2

Under Ubuntu Linux (11.04)

  • Use Ubuntu Software Center to search for "Maven2"
  • Install "Java Software Project Management and Comprehension tool" (maven2)
  • This permitted mvn -version to run as expected:
jett@sagitta:/etc$ mvn -version
  Apache Maven 2.2.1 (rdebian-4)
  Java version: 1.6.0_22
  Java home: /usr/lib/jvm/java-6-openjdk/jre
  Default locale: en_US, platform encoding: UTF-8
  OS name: "linux" version: "2.6.38-11-generic" arch: "i386" Family: "unix"

Config

  • Edited conf/settings.xml (also found under ~/.m2/settings.xml):
    • Set localRepository: <localRepository>D:/data/.m2/repository/</localRepository>
    • Setup servers (phoenix currently)
    • Added proxy config (Only required behind a firewall; no need for a proxy to get out to the internet for home machines.):
    <proxy>
      <id>optional</id>
      <active>true</active>
      <protocol>http</protocol>
      <!-- <username>proxyuser</username>
      <password>proxypass</password> -->
      <host>proxy.bls.com</host>
      <port>8080</port>
      <nonProxyHosts>localhost|127.0.0.1</nonProxyHosts>
    </proxy>

Tell Eclipse how to get to the Global settings

This is for Windows (andromeda in particular)

conf-settings.xml.png

After making these changes, need to ask Maven to update the project configuration (in Package Explorer, right-click -> Maven -> Update Project Configuration …)

Workspace

  • Maven Workspace covers setting up the workspace for a Standalone that accommodates Eclipse.

Troubleshooting

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License