Table of Contents
Java is one concurrency, class-based, object-oriented programming language. It is freely available and can be run on any platform or operating system. Java is a very simple and easy to learn programming language. Many of you, like us, may continue to run into problems while using the tool.
Error injecting: org.apache.maven.plugin.war.WarMojo com.google.inject.ProvisionException: Unable to provision in Java, for example, is one of the most frequently asked errors. So, how do we resolve this? We will discuss together to figure out the best solution.
When Does The Error “Error injecting: org.apache.maven.plugin.war.WarMojo com.google.inject.ProvisionException: Unable to provision in Java” Happen?
You are attempting to run the Java application but are encountering the following error.
Error injecting: org.apache.maven.plugin.war.WarMojo com.google.inject.ProvisionException: Unable to provision, see the following errors:
Error injecting constructor, java.lang.ExceptionInInitializerError at org.apache.maven.plugin.war.WarMojo.<init>(Unknown Source) while locating org.apache.maven.plugin.war.WarMojo
The Most Simple Methods For You
Solution 1: Configure the war plugin
You need to configure the war plugin in your POM.xml like this.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.3.2</version>
</plugin>
Solution 2: Change JDK for the project
You have to change your JDK for a specific project. Continue with this step.
- Left-click on your project.
- Click on Properties.
- Choose Build.
- You need to choose the compile.
- Version 14 of the JDK should be used.
- You can get it here if you do not already have JDK 14.
Solution 3: Deploy the war
Deploy the war with the following verson and command
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<inherited>true</inherited>
<version>3.8.1</version>
<configuration>
<source>16</source>
<target>16</target>
<compilerArguments>
<endorseddirs>${endorsed.dir}</endorseddirs>
</compilerArguments>
</configuration>
</plugin>
Conclusion
Java’s ranking continuously remains in the top 2 languages because of its powerful features and security.
If you’re having trouble with the error “Error injecting: org.apache.maven.plugin.war.WarMojo com.google.inject.ProvisionException: Unable to provision in Java“, the solutions above are the quickest ways out.
If you still need advice or have other concerns, there is a growing community where everyone is usually willing to help. Finally, we hope you’re having a good time with the amazing code options and appreciate your reading time.
Leave a comment