Error injecting: org.apache.maven.plugin.war.WarMojo

We Are Going To Discuss About Error injecting: org.apache.maven.plugin.war.WarMojo. So lets Start this Java Article.

Error injecting: org.apache.maven.plugin.war.WarMojo

  1. Error injecting: org.apache.maven.plugin.war.WarMojo

    I had the same problem. I am using Eclipse Jun 2021 release. The problem got resolved after manually configuring one of the recent war plug-ins in POM.xml.
    <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>3.3.1</version> </plugin>

  2. org.apache.maven.plugin.war.WarMojo

    I had the same problem. I am using Eclipse Jun 2021 release. The problem got resolved after manually configuring one of the recent war plug-ins in POM.xml.
    <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>3.3.1</version> </plugin>

Solution 1

I had the same problem. I am using Eclipse Jun 2021 release. The problem got resolved after manually configuring one of the recent war plug-ins in POM.xml.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>3.3.1</version>
</plugin>

Original Author Of This Content

Solution 2

You can fix it by changing the JDK in your projects to JDK 14. Left-click on your project and go to properties -> build -> compile . Change the JDK to version 14. If you don’t have JDK 14, you can manage it there by clicking Manage Java Platforms. The download of the JDK is here.

Original Author Of This Content

Solution 3

I have solved this by simply going in the Jenkins global tool configuration and changing the path of JDK to /usr/local/Cellar/[email protected]/11.0.10.
Previously it was /usr/local/Cellar/openjdk/16.0.1 in my local machine MAC.

Click here to see

This was the error :

Downloaded from central: https://repo.maven.apache.org/maven2/com/thoughtworks/xstream/xstream/1.3.1/xstream-1.3.1.jar (431 kB at 529 kB/s)
11:52:49 [WARNING] Error injecting: org.apache.maven.plugin.war.WarMojo
11:52:49 com.google.inject.ProvisionException: Unable to provision, see the following errors:
11:52:49 
11:52:49 1) Error injecting constructor, java.lang.ExceptionInInitializerError: Cannot access defaults field of Properties
11:52:49   at org.apache.maven.plugin.war.WarMojo.<init>(Unknown Source)

Original Author Of This Content

Solution 4

Eclipse 2021-06 release by default JDK will be set to 16. So changed to your preferred JDK version. or configure your default JDK to run
enter image description here

maven-war-plugin:3.0.0:war (default-war) @ projectname 
--- [WARNING] Error injecting: org.apache.maven.plugins.war.WarMojo 
com.google.inject.ProvisionException: Unable to provision, 
see the following errors: 1) Error injecting constructor,
java.lang.ExceptionInInitializerError 
at org.apache.maven.plugins.war.WarMojo.<init>(Unknown Source)

Original Author Of This Content

Conclusion

So This is all About This Tutorial. Hope This Tutorial Helped You. Thank You.

Also Read,

Siddharth

I am an Information Technology Engineer. I have Completed my MCA And I have 4 Year Plus Experience, I am a web developer with knowledge of multiple back-end platforms Like PHP, Node.js, Python and frontend JavaScript frameworks Like Angular, React, and Vue.

Leave a Comment