Maven task fail with Could not find or load main class

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Problem

Maven task fail with the following appears in the build log:

1 error 08-Mar-2019 09:19:15 Error: Could not find or load main class xxx.xxx.xxx

Cause

Maven executable in Agent Capabilities isn't configured with the real Maven Home, for example /usr (incorrect setting).

Resolution

  1. Navigate to Administration > Build Resources > Agents

  2. Click on the related agent name

  3. In the Capabilities tab, edit the Maven executable path to the real Maven Home

Updated on April 8, 2025

Still need help?

The Atlassian Community is here for you.