欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

JAR包的制作

程序员文章站 2022-04-30 11:33:22
...

1.安装Gradle

https://gradle.org/install/

$ 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.