Ruchi
Ruchi

Reputation: 249

Unable to load the mojo 'war' in the plugin 'org.apache.maven.plugins:maven-war-plugin:2.2' due to an API incompatibility

I am trying to build my office project where I've upgraded from java 11 to 17.

I've updated my maven according to the compatible java version and after getting a a lot of help on the rest of the errors I'm still stuck on this one.

Things I've updated till now:
Eclipse version, java version , java version , surefire plugin details, mirrorOf tag in settings.xml.

Details of the versions are mentioned below :

Now after setting up everything , this is the error. Please help me in rectifying this :


Unable to load the mojo 'war' in the plugin 'org.apache.maven.plugins:maven-war-plugin:2.2' due to an API incompatibility: org.codehaus.plexus.component.repository.exception.ComponentLookupException: Cannot access defaults field of Properties

EDIT 1 : Adding the pom.xml 4.0.0

Upvotes: 15

Views: 26256

Answers (1)

Oshan Pitigala
Oshan Pitigala

Reputation: 171

Try below options

  1. In your pom.xml, configure the below plugins

    • maven-compiler-plugin -> 3.10.1
    • maven-war-plugin -> 3.3.2
  2. Try cleaning the project and updating the maven dependencies (right-click project -> Maven -> Update Project)

  3. If it doesn't work, there might be an issue with your Maven install. You may try uninstalling the M2Eclipse plugin, deleting the .m2 folder on your drive, and then reinstalling M2Eclipse.


PS:

I noticed that you have used servlet 3 dependencies in your project. Since you are using java 17, you might upgrade them accordingly to the latest available versions

Upvotes: 16

Related Questions