Failed to execute goal org.apache.maven.plugins - Quick Fix

People are currently reading this guide.
[New] Are you using Windows?
Want to make your computer a masterpeace?
You gotta see this. Opens in New Tab.




Getting this error "Failed to execute goal org.apache.maven.plugins"? Not able to get rid of "Failed to execute goal" issue? We have a step by step guide to resolve this issue in minutes. Keep on reading the tutorial.

It is very common issue and many maven users face this while building their project. But the problem lies within the POM xml you have. But we will try to point all the possible places where you can go and look for Failed to execute goal org.apache.maven.plugins issue.

Failed to execute goal org.apache.maven.plugins

Recheck POM xml

In order to fix issue, you first look at POM xml and make sure the version is specified and is correct.


</dependencies>
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.5.8</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
    </plugins>
</build>

Along with this make sure  that eclipse.ini has also got the right JRE Java Runtime Environment version specified in it.

Maven Compiler Versions

You also need to look at the maven source and target versions you have used. Make sure they are in line and right.


<properties>
 <maven.compiler.source>1.5</maven.compiler.source>
 <maven.compiler.target>1.5</maven.compiler.target>
</properties>

JDK Incompatibility

Many a times it also is caused when OpenJDK is not compatible with your Java version. For example if you are not requiring Java 8 then simply purge it and get going.



sudo apt-get remove --purge openjdk-8-jdk openjdk-8-jre
sudo apt-get remove --purge openjdk-8-jdk-headless openjdk-8-jre-headless


Configuration Version


When you have seen all the above check, then you must also see the configuration settings in xml. Make sure that the version specified in configuration source and target is your JDK version.


<configuration>
    <source>1.9</source>
    <target>1.9</target>
 </configuration>

The Last Weapon

If all of this is updated, even if you experience this problem, then try to execute this command directly from the terminal rather than executing from eclipse

$ mvn clean install 

Before executing this make sure these things:
  1. System path is correct for maven
  2. Dependencies are correct for "m2/repository"
  3. Java, JDK, JAVA_HOME is in the path
This would have solved your issue of Failed to execute goal org.apache.maven.plugins. Good luck. To download the latest version of Maven here is the link..