Tag Archives: mvn package

Failed to execute goal

To summarize, Maven packaging, a project engineering development tool called Idea14, uses JDK version 1.8
1. You need to close the idea before packaging, otherwise part of the files will not be deleted when MVN is clean, and files will also be lost when MVN is package.

2. MVN package packaging ERROR: [ERROR] Failed to execute goal. Org. Apache maven. Plugins: maven – clean – plugin: 2.6.1: clean (default – the clean) on the project
Solutions:
1. The POM configuration for the Maven plug-in is as follows:

<plugin>  
    <groupId>org.apache.maven.plugins</groupId>  
    <artifactId>maven-compiler-plugin</artifactId>  
    <version>3.1</version>  
    <configuration>  
        <verbose>true</verbose>  
        <fork>true</fork>  
        <executable>${JAVA_HOME}/bin/javac</executable>  
    </configuration>  
</plugin>  

${JAVA8_HOME} (${JAVA8_HOME}, ${JAVA8_HOME})

The ${JAVA8_HOME} variable is configured in settings.xml as follows:

<profile>  
            <id>custom-compiler</id>  
            <properties>  
                <JAVA8_HOME>C:\Program Files (x86)\Java\jdk1.8.0_73</JAVA8_HOME>  
            </properties>  
</profile>  

Of course this should be enabled, so the settings.xml file should also have the following configuration:

<activeProfiles>  
        <activeProfile>custom-compiler</activeProfile>  
</activeProfiles>  

Maven has a default repository. M2 repository and a default settings.xml configuration file. This default settings.xml file also adds a JAVA_HOME variable, and the compile is completed. If you are using the MVN package command in the CMD window, you are not using the settings.xml in idea. You are using the settings.xml in E: Tools\ maven \conf. You are using the Settings in E: Tools\ maven \conf. Because there is no default configuration to compile using the 1.8 version of the JDK, the JAVA_HOME could not be found before, resulting in a compilation failure.