1.安装Gradle
$ brew install gradle
将Gradle Path加入~/.bash_profile
$ export PATH=$PATH:/opt/gradle/gradle-4.10/bin
检查Gradle是否安装成功
$ gradle -v
------------------------------------------------------------
Gradle 4.10
------------------------------------------------------------
2.Create a library project
$ mkdir building-java-libraries
$ cd building-java-libraries
$ gradle init --type java-library
3.Build
$ ./gradlew build
> Task :compileJava
> Task :processResources NO-SOURCE
> Task :classes
> Task :jar
> Task :assemble
> Task :compileTestJava
> Task :processTestResources NO-SOURCE
> Task :testClasses
> Task :test
Picked up _JAVA_OPTIONS: -Xmx2048m -Xms512m
> Task :check
> Task :build
BUILD SUCCESSFUL in 12s
4 actionable tasks: 4 executed
PS: Jar project can not import aar dependency.
网友评论