Build path specifies execution environment J2SE-1.5. There are no JREs installed in the workspace th

本文介绍了解决Maven项目中因JRE环境不兼容导致的构建问题的方法。通过在pom.xml中配置maven-compiler-plugin插件,指定源代码和目标代码的JDK版本为1.8,并设置编码格式为UTF8,再更新项目即可解决。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >


警告问题:

       Build path specifies execution environment J2SE-1.5. There are no JREs             installed in the workspace that are strictly compatible with this                               environment.       

       类型:JRE System Library Problem

解决办法:

       找到Maven项目中的pom.xml文件, 

      <build>
            <finalName>campuso2o</finalName>
      </build>修改为:

  

<build>
		<finalName>campuso2o</finalName>
		<plugins>
			<plugin>
				<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-
                     compiler-plugin 下面三行是从这个网址上找到的并去掉plugin标签-->
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>3.8.0</version>
                <!--此处是关联jdk哪个版本和编码类型-->
				<configuration>
					<source>1.8</source>
					<target>1.8</target>
					<encoding>UTF8</encoding>
				</configuration>
			</plugin>
		</plugins>
</build>

此时需要右键点击项目名,选择Maven-->Update project,跟新一下项目,就可以了。

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值