maven构建项目环境问题

打包微服务项目

出现编译打包异常问题:

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

在此说明:每个人的项目环境不一样,所碰到的问题也是只适应部分场景,需要结合实际灵活参考本知识点:
解决思路:
1、IDEA编译方式第一次回到本地用户的settings.xml文件中寻找编译配置

 <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、第二次回去idea中寻找settings.xml中寻找编译级别
在这里插入图片描述

3、maven中pom文件中定义编译JDK版本

 <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、模块里设置每个模块的编译级别
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/YHM_MM/article/details/112760724
今日推荐