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:
- Idea Maven project uses package to package and report error (package does not exist)
- Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile)
- Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.1:test (default-test)
- Maven skip unit test- maven.test.skip And skipstests
- The import Maven project appears http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException Solutions
- Failed to execute goal com.spotify:docker-maven-plugin:1.0.0:build Exception caught: basedir src/mai
- javac Task Error source release 1.7 requires target release
- 解决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
- Maven compilation error: package does not exist jar package does not exist
- Maven download and configuration
- MVN error: @ param not found
- Error resolving version for plugin ‘org.apache.maven.plugins:maven-compiler-plugin’ from the repo…
- How to select the jar package version for Maven package when the jar package versions referenced by multiple modules are inconsistent
- Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.6.0
- Maven global configuration
- “[warning] failed to retrieve plugin descriptor for caused by Maven security agent settings org.apache.maven . plugins:… “
- Error in Maven packaging web project: webxml attribute is required (or pre existing WEB-INF)/ web.xml if executing in update)
- The spring boot project was first created, pom.xml The error is Maven configuration problem. How to solve it?
- About JMH running ERROR: transport error 202: connect failed: Connection refused ERROR