maven构建问题(down下来的springbootdemo只支持jdk1.8)
发布日期:2021-07-20 20:53:10 浏览次数:33 分类:技术文章

本文共 2993 字,大约阅读时间需要 9 分钟。

如何配置中央仓库:

在pom.xml文件中的project下一级插入

4.0.0
maven-aliyun-com
Maven aliyun Mirror
http://maven.aliyun.com/nexus/content/groups/public/
true
false
maven-aliyun-com
Maven aliyun Mirror
http://maven.aliyun.com/nexus/content/groups/public/
true
false
com.star
demo
0.0.1-SNAPSHOT
jar
demo
Demo project for Spring Boot
org.springframework.boot
spring-boot-starter-parent
2.0.4.RELEASE
UTF-8
UTF-8
1.8
org.springframework.boot
spring-boot-starter
org.springframework.boot
spring-boot-starter-test
test
org.springframework.boot
spring-boot-maven-plugin

参考资料:

配置类

网络上的可用中央仓库:

pom.xml文档第一行报错:org.apache.maven.archiver.MavenArchiver.getManifest(org.apache.maven.project.MavenProject, org.apache.maven.archiver.MavenArchiveConfiguration)

原因就是你的maven的配置文件不是最新的
1.help ->Install New Software -> add ->https://otto.takari.io/content/sites/m2e.extras/m2eclipse-mavenarchiver/0.17.2/N/LATEST
或者(更新于2018年4月18日17:07:53)
http://repo1.maven.org/maven2/.m2e/connectors/m2eclipse-mavenarchiver/0.17.2/N/LATEST/
PS:点击 next 前,将 eclipse Install 窗口右下角的 Contact all update sites during install to find required software 选项取消掉。2.一直next confirm 安装更新 提示重启eclipse 然后再右键项目maven update project
参考:https://zhidao.baidu.com/question/1643108684345620340.html

 

启动时报错

记录搭建springboot项目时遇到的一些问题

问题:Exception in thread "main" java.lang.UnsupportedClassVersionError :  unsupported major.minor version 52.0

我的电脑上安装了jdk1.7 和 jdk1.8,虽然创建项目的时候选择了当前使用的jdk版本1.7,但是创建后的发现使用的是jdk1.8,将pom.xml文件中修改为jdk1.7,出现 Exception in thread "main" java.lang.UnsupportedClassVersionError :  unsupported major.minor version 52.0 ,把运行之后的target文件删除,再运行,依旧报错。

解决:重新创建项目,选择jdk版本1.7,降低springboot的版本,问题解决。

 

访问controller映射出问题

出现这个异常说明了跳转页面的url无对应的值.

原因1:

Application启动类的位置不对.要将Application类放在最外侧,即包含所有子包 

原因:spring-boot会自动加载启动类所在包下及其子包下的所有组件.

原因2:

在springboot的配置文件:application.yml或application.properties中关于视图解析器的配置问题: 

当pom文件下的spring-boot-starter-paren版本高时使用: 
spring.mvc.view.prefix/spring.mvc.view.suffix 
当pom文件下的spring-boot-starter-paren版本低时使用: 
spring.view.prefix/spring.view.suffix

原因3:

控制器的URL路径书写问题 

@RequestMapping(“xxxxxxxxxxxxxx”) 
实际访问的路径与”xxx”不符合.

 

转载地址:https://blog.csdn.net/liao0801_123/article/details/81463350 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:Centos6.5 安装 RabbitMQ3.6.1
下一篇:集群分布式quartz的需要的11张表

发表评论

最新留言

逛到本站,mark一下
[***.202.152.39]2024年03月29日 22时11分23秒