Getting org.apache.maven.plugin.Mojo error while building my Project | Community
Skip to main content
Level 2
June 6, 2024
Solved

Getting org.apache.maven.plugin.Mojo error while building my Project

  • June 6, 2024
  • 7 replies
  • 5088 views

[ERROR] 4 errors

[ERROR] role: org.apache.maven.plugin.Mojo

[ERROR] roleHint: biz.aQute.bnd:bnd-baseline-maven-plugin:5.1.2:baseline

Please help me in resolving this Error.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Chandra_Hire

I was getting the same error with maven v3.3.9 but when upgraded to v3.6.3. It fixed this issue.

7 replies

Level 2
June 6, 2024

I tried all possible ways like Redownloading .m2 repository, Copying .m2 repository of my colleague who has got build success.

Deleted the project and downloaded again .

Everything is failing.

Keerthi0555
Level 5
June 10, 2024

Hi @keerthi_ramanukolanu ,

can u check package-info.java under models and add correct version there.

It might help in resolving this error or paste the complete error u are facing.

Thanks.

Level 2
June 10, 2024

Have added in the comments please check.

HrishikeshKagne
Community Advisor
Community Advisor
June 6, 2024

Hi @keerthi_ramanukolanu ,

The org.apache.maven.plugin.Mojo error you’re encountering, specifically related to the bnd-baseline-maven-plugin, suggests issues with the Bndtools Maven plugin configuration. This plugin is used for calculating the semantic versioning baseline of OSGi bundles.

Here's a step-by-step guide to help resolve this issue:

1. Verify Plugin Version Compatibility

Ensure that the version of bnd-baseline-maven-plugin you are using (5.1.2 in this case) is compatible with your Maven and JDK versions.

  • JDK Compatibility: Bndtools may have specific JDK requirements. Check the Bndtools release notes for any version-specific compatibility requirements.
  • Maven Compatibility: Make sure you are using a compatible version of Maven with bnd-baseline-maven-plugin.

2. Update Maven Plugin Configuration

Verify the configuration of the bnd-baseline-maven-plugin in your pom.xml file. Ensure it is properly defined with all required parameters.

Example Configuration:

 

<build> <plugins> <plugin> <groupId>biz.aQute.bnd</groupId> <artifactId>bnd-baseline-maven-plugin</artifactId> <version>5.1.2</version> <executions> <execution> <goals> <goal>baseline</goal> </goals> </execution> </executions> </plugin> </plugins> </build>

 

3. Check for Dependency and Plugin Conflicts

Conflicts between different Maven plugins or dependencies can sometimes cause such errors. Ensure that there are no version conflicts or redundant dependencies in your pom.xml.

  • Exclude Conflicting Dependencies: Use the <exclusions> tag to exclude conflicting dependencies if needed.
  • Use Dependency Management: Manage versions centrally using <dependencyManagement> to avoid conflicts.

4. Clean the Local Repository

Sometimes, issues can be caused by corrupted artifacts in the local Maven repository. Try cleaning your local repository.

 

mvn clean mvn dependency:purge-local-repository

 

5. Run Maven with Debug Logs

Run Maven with debug logs to get more detailed information about the error.

 

mvn clean install -X

 

This will provide more insight into what might be causing the issue.

6. Ensure Correct Repository Configuration

Make sure your settings.xml (usually located in ${MAVEN_HOME}/conf or ${USER_HOME}/.m2) does not have misconfigured repositories or mirrors.

7. Update Maven

Ensure that you are using the latest version of Maven.

 

mvn -v

 

If your Maven version is outdated, download and install the latest version from the Apache Maven site.

8. Test with a Simplified Project

Try creating a simple Maven project to test the bnd-baseline-maven-plugin independently. This can help determine if the issue is with the plugin configuration or specific to your project setup.

Example Simple Project:

Create a minimal pom.xml with only the bnd-baseline-maven-plugin and some basic configuration, and attempt to build it.

9. Check Network Configuration

If your build process involves downloading dependencies, ensure there are no network issues or proxy settings interfering with Maven.

10. Consult the Bndtools Documentation

Refer to the Bndtools Maven Plugin documentation for detailed configuration options and troubleshooting tips.

Sample Maven Configuration for bnd-baseline-maven-plugin

Here's a complete example of a Maven project configuration with bnd-baseline-maven-plugin:

 

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.example</groupId> <artifactId>example-project</artifactId> <version>1.0.0-SNAPSHOT</version> <build> <plugins> <plugin> <groupId>biz.aQute.bnd</groupId> <artifactId>bnd-baseline-maven-plugin</artifactId> <version>5.1.2</version> <executions> <execution> <goals> <goal>baseline</goal> </goals> </execution> </executions> <configuration> <!-- Specify baseline if needed --> <baselineVersion>1.0.0</baselineVersion> </configuration> </plugin> </plugins> </build> </project>

 




Hrishikesh Kagane
Peter_Puzanovs
Community Advisor
Community Advisor
June 6, 2024

Hi Keetrhi,

 

Can you paste entire log to provide you more help?

 

Regards,

Peter

Level 2
June 10, 2024

Have added in the comment, Please check.

Peter_Puzanovs
Community Advisor
Community Advisor
June 11, 2024

Hi @keerthi_ramanukolanu 

 

AEM requires specific logger's as it's bundled in the framework itself. Remove eclipse logger with the sl4j one.

 

1) Import correct Logger

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

 

Then in your code log with the following command:

 

2) Initialize logger

// Add a logger for any errors
private static final Logger LOGGER = LoggerFactory.getLogger(YourClassName.class);

 

3) Inside your methods

LOGGER.info("code executed");

 

Regards,

Peter

Nikhil-Kumar
Community Advisor
Community Advisor
June 6, 2024

@keerthi_ramanukolanu  - Can you please share the whole log.

Level 2
June 10, 2024

Have pasted in the comments

Level 2
June 10, 2024
Content backfill required
March 7, 2025

I was facing the same error and got it fixed by using maven version 3.9.9

Chandra_Hire
Chandra_HireAccepted solution
Level 4
March 15, 2025

I was getting the same error with maven v3.3.9 but when upgraded to v3.6.3. It fixed this issue.