原因:org.gradle.api.internal.artifacts.DefaultModuleVersionSelector

时间:2017-01-13 07:08:43

标签: intellij-idea gradle project

无法在intellij想法中导入gradle项目 原因:org.gradle.api.internal.artifacts.DefaultModuleVersionSelector 我也无法通过终端构建项目。终端中的错误是:

失败:构建因异常而失败。 * 什么地方出了错: 任务执行失败':commons:compileJava'。 编译失败;

gradle file:
buildscript {
    repositories {
       mavenCentral()
     //   maven { url "${artifactoryRepoUrl}" }
        jcenter()
    }  ext {
        springBootVersion = '1.4.2.RELEASE'
        commonsVersion = '0.4.3'
        recruiterVersion = '0.2.6'
        jobseekerVersion = '0.1.9'
    }

    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:1.4.2.RELEASE")
        classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4+"
    }
}

subprojects {

    apply plugin: 'java'
    apply plugin: 'eclipse'
    apply plugin: 'idea'
    apply plugin: 'maven'
    apply plugin: 'org.springframework.boot'
    apply plugin: 'maven-publish'
 repositories {
        mavenLocal()
      mavenCentral()
     //   maven { url "${artifactoryRepoUrl}" }
    }
sourceCompatibility = 1.8
    targetCompatibility = 1.8
 ext {
        springCloudVersion = '1.1.2.RELEASE'
        springSecurityVersion = '4.1.1.RELEASE'
        springRedisVersion = '1.7.2.RELEASE'
        jedisVersion = '2.7.2'
        log4jVersion = '2.6.2'
        jacksonVersion = '2.8.1'
        apacheCommonsVersion = '2.4.2'
        lombokVersion = '1.16.10'
        jnaVersion = '3.0.9'
        jestVersion = '2.0.3'
        beanutilsVersion = '1.9.2'
        jwtVersion = '0.6.0'
        springAWSVersion = '1.1.0.RELEASE'
        mysqlConnectorVersion = '6.0.3'
        springJDBCVersion = '4.3.2.RELEASE'
        dbcpVersion = '2.1.1'
        springCloudAWSVersion = '1.0.4.RELEASE'
        elasticClientVersion = '5.0.2'
        swaggerVersion = '2.4.0'
        jose4jVersion = '0.5.4'
    }
  configurations.all {
        exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging'
        exclude group: 'org.springframework.boot', module: 'logback-classic'
    }
}

2 个答案:

答案 0 :(得分:0)

尝试更改gradle文件,如:

buildscript {
    ext {
        springBootVersion = '1.4.2.RELEASE'
        commonsVersion = '0.4.3'
        recruiterVersion = '0.2.6'
        jobseekerVersion = '0.1.9'
    }
    repositories {
       mavenCentral()
        jcenter()
    }  
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:1.4.2.RELEASE")
        classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4+"
    }
}
subprojects {
  ...

答案 1 :(得分:0)

尝试删除以下行:

classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4+"