Fork me on GitHub

spring框架创建踩坑记录

maven自己下一个,配置环境变量。在idea里面全局设置。

创建maven导入spring框架的时候网速慢可以在右上角project settings中facts导入,或者quickstart。

 1 <mirrors>
 2 <!-- 阿里云仓库 -->
 3 <mirror>
 4 <id>alimaven</id>
 5 <mirrorOf>central</mirrorOf>
 6 <name>aliyun maven</name>
 7 <url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
 8 </mirror>
 9 <!-- 中央仓库1 -->
10 <mirror>
11 <id>repo1</id>
12 <mirrorOf>central</mirrorOf>
13 <name>Human Readable Name for this Mirror.</name>
14 <url>http://repo1.maven.org/maven2/</url>
15 </mirror>
16 <!-- 中央仓库2 -->
17 <mirror>
18 <id>repo2</id>
19 <mirrorOf>central</mirrorOf>
20 <name>Human Readable Name for this Mirror.</name>
21 <url>http://repo2.maven.org/maven2/</url>
22 </mirror>

以上放在maven/conf/settings.xml里面

配置本地仓库

    <localRepository>F:\Javawork\repository</localRepository>

 

idea也能配置阿里云镜像,忘记位置了

 

在写代码之前在pom.xml里导入lombok,junit等,

junit版本要在4.12以上不然有个引用会无法使用。

网速挺重要的,如果实在创不成功就等网速好了再试试

 

若想用xml配置不成功,检查在pom.xml

 1 <build>
 2         <plugins>
 3             <plugin>
 4                 <groupId>org.springframework.boot</groupId>
 5                 <artifactId>spring-boot-maven-plugin</artifactId>
 6                 <version>2.3.4.RELEASE</version>      //注意版本号  
 7             </plugin>
 8 
 9         </plugins>
10 
11             <resources>
12                 <resource>
13                     <directory>src/main/recourse</directory>
14                     <includes>
15                         <include>**/*.xml</include>
16                         <include>**/*.properties</include>
17                     </includes>
18                     <filtering>true</filtering>
19                 </resource>
20             </resources>

 

posted @ 2020-10-18 19:28  卡卡北  阅读(74)  评论(0)    收藏  举报