Download the dependent Jar package via Gradle

Source: Internet
Author: User

The previous time in looking at Gradle article direction it is much simpler than ant, Maven really, especially in the download jar dependency is a jar package that is written with Gradle to rely on the download of a small example:

(1) Establish Build.gradle file

(2) The contents are as follows:

Apply plugin: ' Java '


repositories {
Mavencentral ()
}


dependencies {
Compile "javax.servlet:javax.servlet-api:3.1-b07",
"org.slf4j:slf4j-log4j12:1.7.5",
"org.slf4j:slf4j-jdk14:1.7.5",
"Mysql:mysql-connector-java:5.1.24"

}


Task Copyjars (type:copy) {
From Configurations.runtime
Into ' lib '//target location
}

(3) command line run: Gradle copyjars

(4) The Lib directory is the jar package you need, Gradle automatically analyzes the jar where dependencies are downloaded

Download the dependent Jar package via Gradle

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.