Spring CLI
可以用Spring Initializr或Spirng CLI来构建项目
spring init -list
spring init ( -d || --dependencies ) package1,package2 --build (maven/gradle) ( -p || --package) (war/jar) projectName
spring init -d web,jpa,security --build maven -p jar basic-project
spring init -d web,mustache,jpa,h2,devtools --package-name=com.example.blog --build maven mybloge
|
- Web: API服务
- JPA: 访问数据库的抽象
项目结构图
$ tree basic-project/ basic-project/ ├── HELP.md ├── mvnw # maven wrapper附带脚本 ├── mvnw.cmd ├── pom.xml # maven 构建配置文件 └── src ├── main │ ├── java │ │ └── com │ │ └── example │ │ └── basic_project │ │ └── DemoApplication.java # 入口 │ └── resources │ ├── application.properties # Configuration │ ├── static # 存放js/css,images │ └── templates # 存放页面模板 └── test └── java └── com └── example └── basic_project └── DemoApplicationTests.java
15 directories, 7 files
|
Maven
换源
distributionUrl=https://maven.aliyun.com/repository/central/org/apache/maven/apache-maven/(edition.number)/apache-maven-(edition.number)-bin.zip
|
运行项目