用Gradle構(gòu)建Java Library

Build Java Library With Gradle
Run the init task
gradle init
Assemble the library JAR
./gradlew build
Customize the library JAR
Add version in Jar file name
version = '0.1.0'
Add project name in manifest file
tasks.named('jar') { manifest { attributes('Implementation-Title': project.name, 'Implementation-Version': project.version) } }
Generating Sources JAR
java { withSourcesJar() }
Adding API documentation
Add Javadoc
./gradlew javadoc
Add Javadoc Jar
java { withJavadocJar() }
標(biāo)簽: