I am running a maven based test suite as a task in stand alone Bamboo. I am having problems with a new server that I am standing up where the task fails with:
Error: Could not find or load main class org.codehaus.plexus.classworlds.launcher.Launcher
The same script runs correctly if invoked from a command line. If I got this error there (the command line), I would expect that the environment was not properly setup. I have tried setting the M2_HOME variable and others from the local environment box that's part of the task. The error log shows that those are not taking (I see M2_HOME=/usr instead of M2_HOME=/usr/share/maven, for example). Where should I be looking to fix this problem?
This error can happen when the wrong version of Maven is invoked, so yes it sounds like you are on the right track in trying to get your bamboo agent to launch Maven from the correct location.
If you're using the Maven task type, then you can configure the agent to launch the correct Maven executable by configuring the Maven capability on the agent (see https://confluence.atlassian.com/display/BAMBOO/Defining+a+new+executable+capability)
Thank you for your question.
When you set up M2_HOME as a system environment variable, was Bamboo running already? If so, I would kindly ask you to stop and start Bamboo once again, please. By doing that, Bamboo should pick up Maven capabilities automatically.
If you find this answer useful, I would kindly ask you to accept it so the same will be visible to others who might be facing the same issue you have inquired.
Thank you for your understanding.
Rafael P. Sperafico
I stopped Bamboo, checked for the desired variables, restarted bamboo, re-ran the test and continued to get this: Beginning to execute external process for build 'TestSuite - AT - CodeCheckout #4 (TS-AT-COD-4)' ... running command line: /usr/bin/mvn --batch-mode -Djava.io.tmpdir=/test/bamboo/bamboo-home/temp/TS-AT-COD clean test ... in: /test/bamboo/bamboo-home/xml-data/build-dir/131073/TS-AT-COD ... using extra environment variables: bamboo_capability_system_jdk_JDK_1_7=/usr/lib/jvm/java-7-oracle JAVA_HOME=/usr/lib/jvm/java-7-oracle bamboo_planRepository_type=bb bamboo_shortPlanName=AT bamboo_planKey=TS-AT bamboo_planRepository_1_branchName=master bamboo_capability_system_builder_mvn3_Maven_3_0_5=/usr/share/maven bamboo_repository_1671179_previous_revision_number=d792fb145841d1b86c3f8363a20487be06b94057 bamboo_shortPlanKey=AT bamboo_shortJobKey=COD bamboo_build_working_directory=/test/bamboo/bamboo-home/xml-data/build-dir/131073/TS-AT-COD bamboo_repository_1671179_revision_number=d792fb145841d1b86c3f8363a20487be06b94057 bamboo_repository_revision_number=d792fb145841d1b86c3f8363a20487be06b94057 M2_HOME=/usr bamboo_planName=TestSuite - AT bamboo_buildResultsUrl=http://archive.touchplan.io:8085/browse/TS-AT-COD-4 bamboo_buildResultKey=TS-AT-COD-4 bamboo_planRepository_revision=d792fb145841d1b86c3f8363a20487be06b94057 bamboo_capability_system_jdk_JDK_1_7_0_65=/usr/lib/jvm/java-7-oracle bamboo_capability_system_git_executable=/usr/bin/git bamboo_repository_previous_revision_number=d792fb145841d1b86c3f8363a20487be06b94057 bamboo_buildKey=TS-AT-COD bamboo_working_directory=/test/bamboo/bamboo-home/xml-data/build-dir/131073/TS-AT-COD bamboo_agentWorkingDirectory=/test/bamboo/bamboo-home/xml-data/build-dir/131073 bamboo_buildPlanName=TestSuite - AT - CodeCheckout bamboo_repository_1671179_name=AutoTest bamboo_repository_name=AutoTest useMavenReturnCode=false bamboo_repository_1671179_branch_name=master bamboo_resultsUrl=http://archive.touchplan.io:8085/browse/TS-AT-COD-4 bamboo_planRepository_1_revision=d792fb145841d1b86c3f8363a20487be06b94057 bamboo_ManualBuildTriggerReason_userName=bamboo bamboo_planRepository_1_type=bb bamboo_planRepository_1_previousRevision=d792fb145841d1b86c3f8363a20487be06b94057 MAVEN2_HOME=/usr bamboo_planRepository_1_name=AutoTest bamboo_capability_system_builder_mvn3_Maven3=/usr bamboo_planRepository_branchName=master bamboo_capability_system_jdk_JDK=/usr/lib/jvm/java-7-oracle bamboo_shortJobName=CodeCheckout bamboo_repository_branch_name=master
Hello Patrick, Thank you for your update. We had some issues related to Maven v3.0.5. Due to that, I would kindly ask you to upgrade Maven to v3.2.1 for example. Once the upgrade is done, I would kindly ask you to go to (Bamboo administration >> Build resources >> Server Capabilities) and hit (Detect server capabilities). Please let me know if Bamboo picks up the new Maven installation and the location set up on $M2_HOME. — Kind regards, Rafael P. Sperafico Atlassian Support
Hi @Krystian Brazulewicz,
I am having exactly the same problem than @Patrick Foster.
The information shown in the execution log also shows:
The location of maven on our Bamboo server is '/usr/bin/mvn'
So I tried to modify the configuration of mvn within the server capabilities. After setting the whole mvn path, I get this error:
Unable to find executable at /usr/bin/mvn/bin/mvn. Will try to run it anyway
This error somehow shows that Bamboo automatically adds '/bin/mvn' to the path configured in the server capabilities.
While searching for more information I could find this open issue: https://jira.atlassian.com/browse/BAM-15767
Is there any workaround you could provide us meanwhile the problem is solved?
Thanks for your help and best regards!
I was experiencing the same problem and the fix for me was changing the executable path.
On Ubuntu 12.04 the correct path for the maven executable is /usr/share/maven. Bamboo then correctly adds bin/mvn for the executable and sets M2_HOME to usr/share/maven as it should.
I'm John Allspaw, co-founder of Adaptive Capacity Labs, where we help teams use their incidents to learn and improve. We bring research-driven methods and approaches to drive effective inciden...
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!
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