在IDEA中使用gradle下载太长时间

时间:2016-12-23 02:31:00

标签: web intellij-idea gradle

当我开始一个新项目时,下载整个jar文件需要很长时间(超过5个小时),我该如何处理?

这是我的build.gradle文件中的代码:

import com.sun.org.apache.xalan.internal.xsltc.cmdline.Compile

apply plugin: 'idea'
apply plugin: 'java'
apply plugin: 'war'

sourceCompatibility = 1.7
version = '1.0'

repositories {
    mavenCentral()
}

dependencies {
    compile 'javax:javaee-api:7.0'
    compile 'mysql:mysql-connector-java:5.1.39'
    compile 'jstl:jstl:1.2'
    compile 'com.fasterxml.jackson.core:jackson-databind:2.5.3'
    compile 'org.mybatis:mybatis:3.4.1'
    compile 'commons-fileupload:commons-fileupload:1.3.1'
    compile 'org.springframework:spring-context:4.3.4.RELEASE'
    compile 'org.springframework:spring-jdbc:4.3.4.RELEASE'
    compile 'org.springframework:spring-webmvc:4.3.4.RELEASE'
    compile 'org.springframework:spring-context-support:4.3.4.RELEASE'
    compile 'org.projectlombok:lombok:1.16.6'
    compile 'org.mybatis:mybatis-spring:1.3.0'
    compile 'org.freemarker:freemarker:2.3.23'
    compile 'org.jasypt:jasypt:1.9.2'
}

1 个答案:

答案 0 :(得分:0)

您可以使用最近的maven存储库进行gradle;

将存储库添加到builde.gradle:

maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'}

在builde.gradle中:

buildscript {
    repositories {
        maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'}
        maven { url "https://repo.spring.io/plugins-release" }
    }
    dependencies {
        classpath("org.springframework.build.gradle:propdeps-plugin:0.0.7")
        classpath("org.asciidoctor:asciidoctor-gradle-plugin:1.5.3")
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.0.5-2"
        classpath("io.spring.gradle:docbook-reference-plugin:0.3.1")
    }
}

详细信息:https://pingcai.me/2016/12/16/Maven-Gradle-Resolve-Dependencies-%E9%80%9F%E5%BA%A6%E5%A5%87%E6%85%A2%E6%97%A0%E6%AF%94/