Wrong Maven2 environment variables


I am running the latest Bamboo version 3.3 on a ubuntu 10.10 64bit.

Today I tried to add a Maven2 job to a build plan but I am struggling with some configuration.

First of all, Bamboo 3.3 seems to have a bug with the Maven2 executable: When specifying the correct build path in the capabilities (for me /usr/bin/mvn) the job will try to execute /usr/bin/mvn/bin/mvn . I figured "/bin/mvn" is somehow hardcoded so I changed the build path to just "/usr" and that worked.

However, now I'm struggling with the M2_HOME directive. In the logs I see that Bamboo is setting them to "/usr"


which results in

25-Okt-2011 15:14:50 	Exception in thread "main" java.lang.NoClassDefFoundError: org/codehaus/classworlds/Launcher
25-Okt-2011 15:14:50 	Caused by: java.lang.ClassNotFoundException: org.codehaus.classworlds.Launcher
25-Okt-2011 15:14:50 	        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
25-Okt-2011 15:14:50 	        at java.security.AccessController.doPrivileged(Native Method)
25-Okt-2011 15:14:50 	        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
25-Okt-2011 15:14:50 	        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
25-Okt-2011 15:14:50 	        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
25-Okt-2011 15:14:50 	        at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
25-Okt-2011 15:14:50 	Could not find the main class: org.codehaus.classworlds.Launcher.  Program will exit.

This is obviously wrong. But I do not find how to make bamboo change that environment variable. My correct maven2 home is /usr/share/maven2. Or is this possibly another wrongly hardcoded thing like the build path?

Thanks for your help,

7 answers

1 accepted

0 vote

The Maven task is supposed to work with an unmodified Maven distribution as downloaded from http://maven.apache.org/ .

It won't work with Mavens repackaged by distribution maintainers.

Thanks for the tip.

Is this somewhere noted in the documentation? I could not find anything about that, this is definitely an important information!

Not sure what you mean by this. I have same problem, it uses /usr/share/maven2/bin/mvn/bin/mvn

When I point the maven executable path to /usr/share/maven2/bin/mvn

Why does it add /bin/mvn at the end on its own? This is not quite annoying.

If you are not going to allow setting this property, why have it at all?

Hi everyone,

I am struggling with the exact same problem. Is this still an issue in the configuration? I have my maven installation in usr/local/sbin/mvn. However, bin/mvn will always be concatenated to the path.

I am running Bamboo 4.4.2 on Ubuntu 10.04.4. Any help would be very much appreciated.

Cheers, Lukas

just to be clear. running the command manually from the bamboo user works. Setting the M2_HOME directive for the user does not change anything as it is overridden by bamboo as the first snippet is the log with

... using extra environment variables:


This still seems to be an issue...

I'm also facing the exact same issue on. Is there a workaround?


Oracle Linux Server release 6.5 and Bamboo 5.8.1

As a workaround instead of using maven built in task 

I just call maven from as a script task.

Suggest an answer

Log in or Join to answer
Community showcase
Louis De Jaeger
Posted Thursday in Off-topic

Friday fun: your best joke

Hi all Lets make this Friday fun really fun and post one (or more) of your best jokes! The joke can be about an Atlassian product, or just a really fun joke you want to share! I’m not the best j...

187 views 12 3
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot