idea新建springboot项目pom文件报错

前言

之前也有过类似的情况,只不过都是把spring-boot-starter-parent版本号改成本地仓库已经有的,然后继续开发。今天想写个demo,就新建了一个,然后版本号不一致,就一直报错,所以找了一天问题,才解决。太可怕了

新建springboot项目的问题

使用idea,一路next,到最后生成项目
然后pom文件报错
我特意换了一个全新的maven,发现是因为jar拉不下来,就配置了国内镜像
找到maven ,conf 打开 settings.xml。在mirrors里面写入

<!-- 阿里云镜像 -->
	<mirror>
		<id>alimaven</id>
		<name>aliyun maven</name>
		<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
		<mirrorOf>central</mirrorOf>
	</mirror>
	<mirror>
		<id>central</id>
		<name>Maven Repository Switchboard</name>
		<url>http://repo1.maven.org/maven2/</url>
		<mirrorOf>central</mirrorOf></mirror>
	<mirror>
		<id>repo2</id>
		<mirrorOf>central</mirrorOf>
		<name>Human Readable Name for this Mirror.</name>
		<url>http://repo2.maven.org/maven2/</url>
	</mirror>
	
	<mirror>
		<id>ibiblio</id>
		<mirrorOf>central</mirrorOf>
		<name>Human Readable Name for this Mirror.</name>
		<url>http://mirrors.ibiblio.org/pub/mirrors/maven2/</url>
		</mirror>
<!-- 中央仓库在中国的镜像 -->
	<mirror>
		<id>maven.net.cn</id>
		<name>oneof the central mirrors in china</name>
		<url>http://maven.net.cn/content/groups/public/</url>
		<mirrorOf>central</mirrorOf>
	</mirror>

然后发现还是有点问题,有些拉不下来。
继续设置idea,打开设置,搜索maven

将上面的勾打上
然后在VM Options下面输入

-Dmaven.wagon.http.ssl.insecure=true
-Dmaven.wagon.http.ssl.allowall=true
-Dmaven.wagon.http.ssl.ignore.validity.dates=true

然后点击最右面maven,重新安装一下
(拉完jar之后再把勾去掉,还原)

此时已经解决了我所有报错的问题,然后启动项目是启动不起来的,因为没有web
继续在pom加入spring-boot-starter-web

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

启动类中加入hello代码校验

启动,浏览器输入http://localhost:8080/hello

哎。真tm菜

  • 3
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
当使用IDEA创建Spring Boot项目,出现"Error: connect timed out"错误可能有几个原因。 首先,这个错误可能是由于网络连接问题造成的。请确保你的网络连接正常,并且可以访问所需的资源。你可以尝试使用其他网络进行创建项目,或者检查防火墙设置是否对IDEA进行了限制。 另外,这个错误也可能是由于IDEA配置不正确导致的。你可以检查一下IDEA的代理设置是否正确,并确保IDEA可以正常访问所需的资源。 此外,还有一种可能是由于创建项目选择的依赖或模板有问题。有些依赖可能需要从远程仓库下载,如果该仓库无法访问或速度较慢,就会出现连接超的错误。你可以尝试更换依赖或者使用本地仓库来解决这个问题。 综上所述,如果你在使用IDEA创建Spring Boot项目遇到"Error: connect timed out"错误,建议你检查网络连接和代理设置,并确保所选的依赖和模板可用。如果问题仍然存在,你可以尝试使用其他方式创建项目,比如使用Spring Initializr的网页版创建项目。 <span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *3* [idea里面新建springboot报错](https://blog.csdn.net/laofoye123/article/details/122825548)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] - *2* [IDEA创建一个springboot项目教程(过程中各种报错解决)](https://blog.csdn.net/qq_51580852/article/details/127171360)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值