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.
Read More:
- Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.6.0
- [Solved] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test
- Failed to execute goal org.codehaus.mojo:exec-maven-plugin:3.0.0:exec (default-cli) on project Hello
- How to Solve Error: Failed to execute goal org.codehaus.mojo:……..
- Failed to execute goal com.spotify:docker-maven-plugin:1.0.0:build Exception caught: basedir src/mai
- Failed to execute goal on project XXXX-api: Could not resolve dependencies for pro
- 解决Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile
- How to Fix Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile
- Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile)
- Failed to execute goal in Maven build org.apache.tomcat .maven:
- Failed to execute goal org.apache.maven.plugins:maven-gpg-plugin:1.6:sign
- Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.1:test (default-test)
- [ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war (default-war) on pr
- Failed to execute goal org.apache.maven . plugins:maven-surefire-plugin :2.12.4:test
- RocketMQ Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:2.17:check…
- Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:2.9.1:jar (default) on project
- Error: Failed to execute goal org.mybatis.generator:mybatis-generator-maven-plugin:1.3.2
- Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:3.0.0:clean (default-clean) on
- Failed to execute goal org.apache.maven . plugins:maven-clean-plugin :2.6.1:cle
- Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.2:run (default-cli) on project