pom配置spring信息(Downloading Spring artifacts)

参考资料:github介绍 https://github.com/spring-projects/spring-framework/wiki/Downloading-Spring-artifacts

介绍:在我们搭建j2ee工程时,往往会用到spring的相关jar包(spring-mvc、spring-core、spring-context等),而现在搭建web工程往往都是通过maven或者gradle等工具进行管理。以maven为例,当我们选择spring时,会面临如下几个问题:

1>  不知道会用到spring哪些相关jar包?

2> spring的artifacts在pom中不知道怎么配置?

3>spring是怎样定义出dependency的?

带着上面疑问,解读一下github上wiki说明,其实spring是分模块化划分项目,如下是spring相关项目:

spring版本说明:

 

通过以上两张图片,很容看明白spring有多少个项目,每个项目版本是怎样迭代的。弄明白后,maven管理就更容易懂了:

实例:

        <dependency> 

      <groupId>org.springframework</groupId>       <!--groupId 特定-->

      <artifactId>spring-context</artifactId>  <!--模块名称-->

      <version>3.1.0.RELEASE</version>   <!--版本号-->

        </dependency>

S D:\project_vscode\demo> ./mvnw spring-boot:run [INFO] Scanning for projects... Downloading from central: https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-maven-plugin/与%20Spring%20Boot%20版本一致/spring-boot-maven-plugin-与%20Spring%20Boot%20版本一致.pom [WARNING] Failed to retrieve plugin descriptor for org.springframework.boot:spring-boot-maven-plugin:与 Spring Boot 版本一致: Plugin org.springframework.boot:spring-boot-maven-plugin:与 Spring Boot 版本一致 or one of its dependencies could not be resolved: The following artifacts could not be resolved: org.springframework.boot:spring-boot-maven-plugin:pom:与 Spring Boot 版本一致 (absent): Could not transfer artifact org.springframework.boot:spring-boot-maven-plugin:pom:与 Spring Boot 版本一致 from/to central (https://repo.maven.apache.org/maven2): status code: 400, reason phrase: Invalid URI (400) [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.519 s [INFO] Finished at: 2025-03-21T23:58:44+08:00 [INFO] ------------------------------------------------------------------------ [ERROR] Plugin org.springframework.boot:spring-boot-maven-plugin:与 Spring Boot 版本一致 or one of its dependencies could not be resolved: [ERROR] The following artifacts could not be resolved: org.springframework.boot:spring-boot-maven-plugin:pom:与 Spring Boot 版本一致 (absent): org.springframework.boot:spring-boot-maven-plugin:pom:与 Spring Boot 版本一致 failed to transfer from https://repo.maven.apache.org/maven2 during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.springframework.boot:spring-boot-maven-plugin:pom:与 Spring Boot 版本一致 from/to central (https://repo.maven.apache.org/maven2): status code: 400, reason phrase: Invalid URI (400) [ERROR] -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
03-22
PS D:\project_vscode\demo> ./mvnw clean install -U [INFO] Scanning for projects... [INFO] [INFO] --------------------------< com.example:demo >-------------------------- [INFO] Building demo 0.0.1-SNAPSHOT [INFO] from pom.xml [INFO] --------------------------------[ jar ]--------------------------------- Downloading from central: https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-maven-plugin/ 与%20Spring%20Boot%20版本一致/spring-boot-maven-plugin-与%20Spring%20Boot%20版本一致.pom [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.188 s [INFO] Finished at: 2025-03-22T00:03:15+08:00 [INFO] ------------------------------------------------------------------------ [ERROR] Plugin org.springframework.boot:spring-boot-maven-plugin:与 Spring Boot 版本一致 or one of its dependencies could not be resolved: [ERROR] The following artifacts could not be resolved: org.springframework.boot:spring-boot-maven-plugin:pom:与 Spring Boot 版本一致 (absent): Could not transfer artifact org.springframework.boot:spring-boot-maven-plugin:pom:与 Spring Boot 版本一致 from/to central (https://repo.maven.apache.org/maven2): status code: 400, reason phrase: Invalid URI (400) [ERROR] -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException PS D:\project_vscode\demo>
最新发布
03-22
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值