Gradle 1.12 User Guide Translation-46th chapter. Java Library Publishing Plug-in

Source: Internet
Author: User

Text by Csdn blog looks like drop line translation, other chapters of translation please see:

Http://blog.csdn.net/column/details/gradle-translation.html

Please pay attention to the address on GitHub in the translation project:

Https://github.com/msdx/gradledoc

The branch in which this article is translated:

https://github.com/msdx/gradledoc/tree/1.12.

For a direct view of the bilingual version of the documentation, please visit:

Http://gradledoc.qiniudn.com/1.12/userguide/userguide.html.

In addition, Android phone users can browse through a program I write, with the cache function, currently 0.2.1 version compatible with Android 2.2 or above, the project address is as follows:

https://github.com/msdx/gradle-doc-apk

Translation is not easy, reprint please indicate the source of this article on the CSDN blog:

http://blog.csdn.net/maosidiaoxian/article/details/50976931

My translation of Gradle is subject to the project on GitHub and the documentation on http://gradledoc.qiniudn.com. Where the translation is found to be wrong, the above two places will be updated first. Due to time and energy issues, the translation published in the blog is basically not synchronized changes.



46th chapter. Java Library Publishing Plug-in

The Java Library Publishing plug-in is still hatching. It is important to note that in future versions of Gradle, the relevant DSL and other configurations may change.

The Java library Distribution plugin adds support for building a distribution ZIP for a Java library. The distribution contains the library and its dependent JAR files.

46.1. Usage

To use the Java distribution plug-in, include the following in the build script:

Example 46.1. Using the Java library distribution plug-in

build.gradle

apply plugin:  ' java-library-distribution '  

To define the name of the distribution, you must set the property as follows baseName :

Example 46.2. Configure the name of the distribution

build.gradle

Distributions {    main{        ' my-name '    }}

The plugin can also generate a distribution file for your library. Distribution will package all the runtime dependencies. All insrc/main/distThe files stored in the archive will be added to the root directory of the distribution. You can run gradle distZip Package the distrubution into a ZIP file.

46.2. Tasks

The Java library distribution plug-in adds the following tasks to the Project object.

Table 46.1. Java Library Distribution Plug-in-task

Task Name relies on Type Describe
distzip jar Zip Create a full distribution ZIP file that contains the run-time library.
46.3. Include additional resources in distribution

All in src/dist directory will be copied. If you want to include any static files in the distribution, simply place them in   src/dist   directory.

Example 46.3. Include files in the distribution package

build.gradle

Distributions {main {baseName =' My-name 'Contents {from {' Src/dist '}        }    }}


Gradle 1.12 User Guide Translation-46th chapter. Java Library Publishing Plug-in

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.