Tuesday, January 22, 2008

Installing Apache Maven 2 on Ubuntu 7.10 Desktop

The Maven software project management tool is indispensable for managing the build process, reporting and documentation for Java development projects. Naturally, one of the first things I wanted to do on my new project was set up the build environment. Unfortunately, Maven is not available as a package for Ubuntu 7.10. It is available in the current unstable release (Hardy Heron).

To install Maven on Ubuntu 7.10, download the following packages from Hardy Heron:

maven2
libdoxia-java
libplexus-container-default-java
libclassworlds-java
libplexus-velocity-java
libjtidy-java
libplexus-interactivity-api-java
libplexus-component-api-java
libplexus-classworlds-java
libplexus-utils-java
libwagon-java


When all of the packages are downloaded, open a terminal and navigate to the directory that contains the packages. Execute the following command:

dpkg -i *.deb
Update: Per some comments, it may be necessary to execute the following command as well:

sudo apt-get install -f


dpkg will download the remaining dependencies and install all of the packages. When installation has completed, you can verify that Maven is installed and working by typing:

mvn --version


You should see something like:

Maven version: 2.0.8
Java version: 1.5.0_13
OS name: "linux" version: "2.6.22-14-generic" arch: "i386" Family: "unix"

10 comments:

Søren Bjerregaard Vrist said...

I needed to do a apt-get -f install
with not argument

after the dpkg -i to complete the installation.

Till said...

Confirmed. The first time I tried to install all packages with

dpkg -i *.deb

I got errors.

sudo apt-get install -f

fixes that.

Thanks for posting this information.
Very helpful. Now I am really looking forward to 8.04!

Axel Gross said...

thanks for the inspiration
sat down to solve this via apt-pinning

so i added hardy to the apt lists.
and added to /etc/apt/preferences:
Package: maven2
Pin: release a=hardy
Pin-Priority: 600

Package: *
Pin: release a=hardy
Pin-Priority: 50


then did:
sudo aptitude update
sudo aptitude --show-deps -vvv -V --simulate install maven2


and that looked good, so i did without the --simulate:
sudo aptitude --show-deps -vvv -V install maven2

should work also fine with future updates IMHO

Jeroen said...

If you're lazy like me, here are the wget's I used:

wget http://nl.archive.ubuntu.com/ubuntu/pool/universe/m/maven2/maven2_2.0.8-3_all.deb
wget http://nl.archive.ubuntu.com/ubuntu/pool/universe/d/doxia/libdoxia-java_1.0-alpha-7-1_all.deb
wget http://nl.archive.ubuntu.com/ubuntu/pool/universe/p/plexus-container-default/libplexus-container-default-java_1.0-alpha-9-stable-1-2_all.deb
wget http://nl.archive.ubuntu.com/ubuntu/pool/universe/c/classworlds/libclassworlds-java_1.1-final-1_all.deb
wget http://nl.archive.ubuntu.com/ubuntu/pool/universe/p/plexus-velocity/libplexus-velocity-java_1.1.6-1_all.deb
wget http://nl.archive.ubuntu.com/ubuntu/pool/universe/j/jtidy/libjtidy-java_7+svn20070309-1_all.deb
wget http://nl.archive.ubuntu.com/ubuntu/pool/universe/p/plexus-interactivity-api/libplexus-interactivity-api-java_1.0-alpha-6-2_all.deb
wget http://nl.archive.ubuntu.com/ubuntu/pool/universe/p/plexus-component-api/libplexus-component-api-java_1.0+svn6316-1_all.deb
wget http://nl.archive.ubuntu.com/ubuntu/pool/universe/p/plexus-classworlds/libplexus-classworlds-java_1.2+svn5720-1_all.deb
wget http://nl.archive.ubuntu.com/ubuntu/pool/universe/libp/libplexus-utils/libplexus-utils-java_1.4.8-1_all.deb
wget http://nl.archive.ubuntu.com/ubuntu/pool/universe/w/wagon/libwagon-java_1.0-beta-2-2_all.deb

The Saint said...
This comment has been removed by the author.
The Saint said...
This comment has been removed by the author.
henrik said...

Axel Gross solution didn't work for me. I tried the wget+dpkg solution, but there were two missing dependencies:
libcommons-openpgp-java and
libganymed-ssh2-java. With them it works, thanks!

Wget them here:
wget http://mirrors.kernel.org/ubuntu/pool/universe/g/ganymed-ssh2/libganymed-ssh2-java_210-2_all.deb
wget
http://mirrors.kernel.org/ubuntu/pool/universe/libc/libcommons-openpgp-java/libcommons-openpgp-java_0+svn533492-1_all.deb

LiLoGia said...

I think using this link is the fastest way to install

http://packages.ubuntu.com/hardy/all/maven2/download

Neal Ravindran said...

I did it an easier way..
I basically downloaded the tar.gz binary from apache and expanded it using "Archive Manager" to my mounted windows partition(I have no space on the ubuntu partition..so kept it on the bigger part..So you can keep the expanded stuff anywhere you want)

I made a shell script with these entries
export M2_HOME=/media/disk/apache-maven-2.0.9
export PATH=${M2_HOME}/bin:${PATH}

(for me since my drive won't me mounted until after I login, I didnt add to .bashrc, but you could just add those to .bashrc)

After doing that it recognized the "mvn" command and also successfully tested it on a project of mine.

Б.Билгүүн said...

you actually can only go to your synaptic package manager and type maven2 and mark it for installation and install it. it will do all the tricks by itself so you do not have to type these lousy commands on your terminal. :)