Skip to main content

Deploying artifacts to the repository using Maven 2 on Ubuntu Linux

Posted by felipegaucho on March 21, 2009 at 12:33 PM PDT

One of the most useful features of the portal is its href=''>Maven 2 repository,
where project owners can publish their project artifacts using standard
Maven features. Following the
instructions of the maven2-repository
project, you should:

  1. href="">Request
    a "Maven Publisher" role
  2. Setup your project to deploy into the maven2
    repository. You should include the configuration in your parent pom (if
    you have a multi-module project). Here you can find my latest version of pom.xml, which includes the configuration like the one below:
          <name> Repository for Maven</name>

            <-- suppress the version to get the latest one -->

  3. href=''>Create
    a file with your authentication credentials:
    vim ~/
    save the file and apply permission 600 to restrict the access to your personal information:
    chmod 600 ~/
  4. run mvn deploy in your project root folder. Here
    I have problems with my Ubuntu installation, because the default maven
    installed by the Synaptic Package Manager does not work with the
    repository protocol java-net. I explain below how to
    workaround on that.

Cannot find wagon which supports the requested protocol:

After following the instructions, I got a strange error
in the terminal:

~/svn/footprint$ mvn deploy
Deploying artifacts to
the main artifact pom.xml
[INFO ] Retrieving previous build number from
ERROR: Error deploying artifact: Failed to transfer file:
Return code is: 401

[INFO] Error retrieving previous build number for artifact '':
repository metadata for: 'snapshot' could not be
retrieved from repository: due to an error:
Unsupported Protocol: 'java-net': Cannot find wagon which supports the requested protocol: java-net

I double checked the ~/ file and other
permissions around - like the settings.xml in the mvn folder - but the
error was in a tricky detail:

The maven installed by the synaptic package
manager of Ubuntu is not the latest apache maven distribution. You
should remove the Ubuntu default maven package and manually install the
Apache Maven for Linux.

This detail is particularly difficult to figure out due to the
fact that most of Java developers do not use Linux - so many of the
responses in the mailing lists are something like never heard about
it... did you follow the instructions properly?
The first sign of
something related to the OS configuration came from my Eclipse, because
when I tried to run the same maven commands through the IDE, the maven
started downloading again some libraries - on that moment I realized it
was using a different repository. After that, a tip of href=''>Julio
Viegas helped me to replace the default Ubuntu maven package by the
latest Apache distribution - problem fixed!

You can find the instructions to install the software here:

If everything works, you should see something like this in the

~/svn/footprint$ mvn --version
Maven version: 2.1.0-M1
Java version: 1.6.0_12
Default locale: en_US, platform encoding: UTF-8
OS name: "linux" version: "2.6.27-11-generic" arch: "i386" family: "unix"

Special hint for Hudson installation

If your system hosts a Hudson application, be sure to update the
installation folders of Maven and Java in the Hudson before starting
your next build sessions - otherwise Hudson will get lost. Just login in
Hudson, go to http://localhost:8080/hudson/configure
and update the path of the applications.

Related Topics >>


yes, it stands for EJB3, just read the plugin instructions page.. the best reference I remember about Maven 2 is the book "Maven: the definitive guide".. what contains details about how to construct all kind of Java archetypes.

Does that j2ee apply for an EJB3 project?

dxxvi: yes, there is this one:

Off topic: is there an archetype or a directory structure with pom.xml files for an EJB3 project?

Thanks for the tip. You saved my day.