如何解决报错invalid target release: 1.8

2025-04-18 15:36:21

1、找到工程的pom.xml文件,在<build>节点下如下插件<build> <plugins> <plugin> &造婷用痃lt;groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.1</version> <configuration> <verbose>true</verbose> <fork>true</fork> <executable>${JAVA8_HOME}/bin/javac</executable> </configuration> </plugin> </plugins></build>

如何解决报错invalid target release: 1.8

2、在maven的安装目录下找到conf/settings.xml文件

如何解决报错invalid target release: 1.8

3、在profile节点下添加如下配置<profile> <id>jdk8compiler</id> <properties> <JAVA8_HOME>C:\Program Files\Java\jdk1.8.0_131</JAVA8_HOME> </properties> </profile>

如何解决报错invalid target release: 1.8

4、在settings节点下添加如下配置:<activeProfiles> <activeProfile>jdk8compiler</activeProfile></activeProfiles>

如何解决报错invalid target release: 1.8

5、再次执行mvn clean install命令,报错信息消失了。

如何解决报错invalid target release: 1.8

6、如果经过上面配置后还有报错信息,请检查工具中配置的maven路径是否正确

如何解决报错invalid target release: 1.8
声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢