maven build project environment problem

table of Contents

Package a microservice project

Compilation and packaging exceptions occur:

Failed to execute goal
org.apache.maven.plugins:maven-compiler-plugin:3.1:compile
(default-compile) on project cloudorde8001: Fatal error compiling

Here is an explanation: everyone’s project environment is different, and the problems encountered are only suitable for some scenarios. You need to refer to this knowledge point flexibly based on the actual situation:
Solution ideas:
1. IDEA compilation method returns to the local user’s settings for the first time. Find the compilation configuration in the xml file

 <profile>
      <id>jdk-1.8</id>

      <activation>
        <property>
          <name>target-env</name>
          <value>dev</value>
        </property>
      </activation>

      <properties>
        <tomcatPath>/path/to/tomcat/instance</tomcatPath>
      </properties>
    </profile>

2. Go back to the idea for the second time to find the compilation level in settings.xml
Insert picture description here

3. The compiled JDK version is defined in the pom file in maven

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

4. Set the compilation level of each module in the module
Insert picture description here

Guess you like

Origin blog.csdn.net/YHM_MM/article/details/112760724