使用Gradle创建Java项目

1
2
3
4
5
# 创建项目目录
mkdir project && cd project

# 把当前目录初始化为Gradle项目
gradle init --type java-library

键盘输入 : 回车 -> 回车 -> 回车 -> [输入项目包名],回车

日志

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
➜  java gradle init --type java-library
➜ java cd spring-learing
➜ spring-learing gradle init --type java-library

Select build script DSL:
1: Groovy
2: Kotlin
Enter selection (default: Groovy) [1..2] 1

Select test framework:
1: JUnit 4
2: TestNG
3: Spock
4: JUnit Jupiter
Enter selection (default: JUnit 4) [1..4] 1

Project name (default: spring-learing):
Source package (default: spring.learing): com.duanjw

> Task :init
Get more help with your project: https://docs.gradle.org/6.4.1/userguide/java_library_plugin.html

BUILD SUCCESSFUL in 15s
2 actionable tasks: 2 executed
坚持原创技术分享,您的支持将鼓励我继续创作!