Chen Ziyu2019需要努力 2021-09-30 17:32
浏览 373
已结题

老gradle项目导入IDEA报错> Supplied String module notation 'gradleApi()' is invalid.

gradle版本4.8.1
build.gradle如下

apply plugin: 'groovy'

repositories {
    mavenCentral()
    maven {
        name = 'SpringSource Enterprise Release'
        url = 'http://repository.springsource.com/maven/bundles/release'
    }
    maven {
        name = 'SpringSource Enterprise External'
        url = 'http://repository.springsource.com/maven/bundles/external'
    }
}

dependencies {
    compile ('gradleApi()')
}

// GAE
dependencies {
    compile 'com.google.appengine:appengine-tools-sdk:1.4.2'
}

dependencies{
    compile "emma:emma:2.0.5312"
}

// Trang
dependencies {
    compile 'com.thaiopensource:trang:20091111',
            'net.sourceforge.saxon:saxon:9.1.0.8'
}

task ide(type: Copy)  {
    from configurations.runtime
    into 'ide'
}

异常信息:

A problem occurred evaluating project ':buildSrc'.
> Supplied String module notation 'gradleApi()' is invalid. Example notations: 'org.gradle:gradle-core:2.2', 'org.mockito:mockito-core:1.9.5:javadoc'.

项目gradle:

import groovy.text.SimpleTemplateEngine

buildscript {
    repositories {
        maven {
            url "https://repo.spring.io/plugins-release"
        }
        maven { url 'https://maven.aliyun.com/repository/central' }
        maven { url 'https://maven.aliyun.com/repository/public' }
        maven { url 'https://maven.aliyun.com/repository/google' }
        maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
        maven { url 'https://maven.aliyun.com/repository/spring' }
        maven { url 'https://maven.aliyun.com/repository/spring-plugin' }
        maven { url 'https://maven.aliyun.com/mvn/guide' }
        maven { url 'https://maven.aliyun.com/repository/apache-snapshots' }
    }
    dependencies {
        classpath("org.springframework.build.gradle:propdeps-plugin:0.0.7")
        classpath("org.springframework.boot:spring-boot-gradle-plugin:1.3.0.RELEASE")
    }
}

description = 'wohut'

allprojects {

    apply plugin: 'java'
    apply plugin: 'eclipse'
    apply plugin: 'idea'
    group = 'wo.hut'

    repositories {
        mavenCentral()
        maven {
            url "http://repo.terracotta.org/maven2/"
        }
    }

    eclipse.project.name = "${project.name}-1.0.x"

    configurations {
        compile.exclude group: 'ch.qos.logback'
        
        compile.exclude group: 'commons-logging'
        
        compile.exclude group: 'jboss-logging'
    }
}

ext.javaProjects = subprojects.findAll {
    project -> project.name != 'docs' && project.name != 'manual'
}

configure(javaProjects) {
    apply from: "$rootDir/gradle/javaprojects.gradle"
}

project('wohut-core') {

    dependencies {
        compile "org.springframework:spring-beans:$springVersion",
        
                "org.springframework:spring-context:$springVersion",
                
                "org.springframework:spring-expression:$springVersion",
                "javax.inject:javax.inject:1",
                
                "org.slf4j:slf4j-api:$slf4jVersion",
                
                "org.slf4j:jcl-over-slf4j:$slf4jVersion",
                
                "org.slf4j:slf4j-log4j12:$slf4jVersion",
                
                "log4j:log4j:$log4jVersion"
    }
}

project('wohut-data') {

    dependencies {
        compile "org.springframework.data:spring-data-commons:$springDataCommonsVersion",
        
                "org.springframework:spring-jdbc:$springVersion",
                "org.springframework.data:spring-data-jpa:$springDataJpaVersion",
                
                "org.springframework:spring-tx:$springVersion",
                
                "org.hibernate:hibernate-core:$hibernateVersion",
                
                "org.hibernate:hibernate-validator:$hibernateValidatorVersion",
                
                "org.hibernate:hibernate-c3p0:$hibernateVersion",
                
                "org.hibernate:hibernate-entitymanager:$hibernateEntityManagerVersion",
                
                "com.jolbox:bonecp:0.8.0.RELEASE",
                
                "commons-pool:commons-pool:1.6",
                
                "org.springframework.data:spring-data-mongodb:1.8.2.RELEASE",
                
                "org.mongodb:mongo-java-driver:3.2.0",
                
                /**
                 *
                 **/
                
                "org.springframework.batch:spring-batch-core:3.0.7.RELEASE"

    }
}

project('wohut-web') {

    dependencies {

        compile "org.springframework:spring-webmvc:$springVersion",
        
                "org.springframework.security:spring-security-config:$springSecurityVersion",
                
                "org.springframework.security:spring-security-web:$springSecurityVersion",
                
                "net.sf.supercsv:super-csv:2.3.1",
                
                "javax.servlet.jsp.jstl:javax.servlet.jsp.jstl-api:$jstlVersion",

                "org.thymeleaf:thymeleaf-spring4:$thymeleafVersion",
                
                "org.thymeleaf.extras:thymeleaf-extras-springsecurity3:2.1.1.RELEASE",
                
                "commons-fileupload:commons-fileupload:1.3",
                
                /**jackon**/
                "org.codehaus.jackson:jackson-mapper-asl:$jacksonVersion",
                
                /**"com.fasterxml.jackson.core:jackson-databind:2.2.1",**/
                /**"org.codehaus.jackson:jackson-mapper-asl:1.9.13",**/
                /**json**/
                "net.sf.ehcache:ehcache:$ehcacheVersion",
                
                "net.sf.ehcache:ehcache-jcache:$ehcacheJCacheVersion"

    }

    configurations {
        compile.exclude group: 'org.javassist'
    }

}


project('wohut-hadoop') {
    dependencies {
        /**hadoop**/
        compile 'org.springframework.data:spring-data-hadoop:2.3.0.RELEASE-hadoop26',
        
                'org.apache.hadoop:hadoop-common:2.7.1',
                
                'org.apache.hbase:hbase-client:1.1.2'
    }
}

project('wohut-messaging') {
    dependencies {

        compile 'org.apache.activemq:activemq-core:5.7.0',
        
                'org.springframework.integration:spring-integration-jms:4.2.2.RELEASE'

        /**websocket**/
        compile "org.springframework:spring-messaging:$springVersion",
        
                "org.springframework:spring-websocket:$springVersion",
                
                "org.projectreactor:reactor-tcp:1.0.0.RELEASE",
                
                "org.webjars:sockjs-client:0.3.4",
                
                "org.webjars:stomp-websocket:2.3.0"

        compile project(":wohut-tools")
    }
}

project('wohut-tools') {

    repositories {

        maven {
            url "http://repo1.maven.org/maven2/"
        }
    }
    dependencies {
        compile 'com.jcraft:jsch:0.1.53',
        
                'com.scottyab:aes-crypto:0.0.4',
                
                'commons-net:commons-net:3.4',
                
                'commons-codec:commons-codec:1.10',
                
                'javax.mail:mail:1.4.7',
                
                'org.bouncycastle:bcprov-jdk15on:1.47'
    }

}

project('wohut-wohut-refactored') {
    apply plugin: 'war'

    dependencies {

        compile project(":wohut-core"),
        
                project(":wohut-data"),
                
                project(":wohut-web"),
                
                project(":wohut-tools")

        compile 'org.apache.axis:axis:1.4',
        
                'axis:axis-wsdl4j:1.5.1',
                
                'javax.xml.rpc:javax.xml.rpc-api:1.1.1',
                
                'commons-discovery:commons-discovery:0.5',
                
                'org.quartz-scheduler:quartz:2.2.2'

        providedCompile "javax.servlet:javax.servlet-api:$servletApiVersion"

        compile 'org.springframework.data:spring-data-redis:1.7.4.RELEASE'
        
        compile 'redis.clients:jedis:2.9.0'
        
        compile("mysql:mysql-connector-java:5.1.24")
        
        compile("com.alibaba:fastjson:1.2.70")
        
        compile("org.bouncycastle:bcprov-ext-jdk16:1.45")

        /* 閺嬩礁鍘滈幒銊╋拷涓糄K */
        compile group: 'cn.jpush.api', name: 'jpush-client', version: '3.3.7'

        compile group: 'com.google.code.gson', name: 'gson', version: '2.3'

        compile group: 'org.apache.mina', name: 'mina-core', version: '2.0.19'
        
        compile group: 'com.corundumstudio.socketio', name: 'netty-socketio', version: '1.7.3'

        compile group: 'com.itextpdf', name: 'itextpdf', version: '5.5.1'
        
        compile group: 'com.itextpdf', name: 'itext-asian', version: '5.2.0'
        
        compile group: 'joda-time', name: 'joda-time', version: '2.9.9'

        /* 鍥剧墖鏃嬭浆闇�瑕佺敤鍒扮殑绫� */
        compile group: 'com.drewnoakes', name: 'metadata-extractor', version: '2.11.0'

        testCompile "junit:junit-dep:$junitVersion"
        
        testCompile "org.springframework:spring-test:$springVersion"
        
        testCompile "org.mockito:mockito-core:$mockitoVersion"
        
        testCompile "org.hamcrest:hamcrest-library:$hamcrestVersion"
        
        compile group: 'com.auth0', name: "java-jwt", version: '3.8.3'

    }

    repositories {
        maven {
            url 'http://download.java.net/maven/2'
        }
        maven {
            url 'file://$projectDir/src/main/webapp/WEB-INF/lib'
        }
        mavenCentral()
    }

    task wrapper(type: Wrapper) {
        gradleVersion = '2.4'
    }
    war {
        baseName = 'wohut'
        from('resources') {
            include '*.properties'
            into 'WEB-INF/classes/'
        }
    }

    eclipse {
        wtp {
            component {
                contextPath = 'wohut'
            }
        }
    }

}

project('wohut-bookstore') {

    apply plugin: 'war'

    dependencies {

        compile project(":wohut-core"),
        
                project(":wohut-web"),
                
                project(":wohut-tools")

        compile "org.springframework.boot:spring-boot-starter-data-mongodb:1.3.0.RELEASE",
        
                "org.springframework.boot:spring-boot-starter-data-jpa:1.3.0.RELEASE"

        providedCompile "javax.servlet:javax.servlet-api:$servletApiVersion"

        testCompile "junit:junit:$junitVersion"
        
        testCompile "org.springframework:spring-test:$springVersion"
        
        testCompile "org.mockito:mockito-core:$mockitoVersion"
        
        testCompile "org.hamcrest:hamcrest-library:$hamcrestVersion"
    }

    repositories {
        maven {
            url 'http://download.java.net/maven/2'
        }
        maven {
            url 'file://$projectDir/src/main/webapp/WEB-INF/lib'
        }
        mavenCentral()
    }

    task wrapper(type: Wrapper) {
        gradleVersion = '2.4'
    }
    war {
        baseName = 'bookstore'
        from('resources') {
            include '*.properties'
            into 'WEB-INF/classes/'
        }
    }

    eclipse {
        wtp {
            component {
                contextPath = 'bookstore'
            }
        }
    }

}

project('wohut-forum') {
    apply plugin: 'war'

    dependencies {

        compile project(":wohut-core"),
        
                project(":wohut-data"),
                
                project(":wohut-web"),
                
                project(":wohut-tools")

        providedCompile "javax.servlet:javax.servlet-api:$servletApiVersion"

        testCompile "junit:junit-dep:$junitVersion"
        
        testCompile "org.springframework:spring-test:$springVersion"
        
        testCompile "org.mockito:mockito-core:$mockitoVersion"
        
        testCompile "org.hamcrest:hamcrest-library:$hamcrestVersion"
    }

    repositories {
        maven {
            url 'file://$projectDir/src/main/webapp/WEB-INF/lib'
        }
        mavenCentral()
    }
    war {
        baseName = 'forum'
        from('resources') {
            include '*.properties'
            into 'WEB-INF/classes/'
        }
    }

    eclipse {
        wtp {
            component {
                contextPath = 'forum'
            }
        }
    }

}
project('wohut-services') {
    apply plugin: 'war'

    dependencies {

        compile project(":wohut-core"),
        
                project(":wohut-data"),
                
                project(":wohut-hadoop"),
                
                project(":wohut-web"),
                
                project(":wohut-tools")


        providedCompile "javax.servlet:javax.servlet-api:$servletApiVersion"

        testCompile "junit:junit:$junitVersion"
        
        testCompile "org.springframework:spring-test:$springVersion"
        
        testCompile "org.mockito:mockito-core:$mockitoVersion"
        
        testCompile "org.hamcrest:hamcrest-library:$hamcrestVersion"
    }

    repositories {
        maven {
            url 'http://download.java.net/maven/2'
        }
        mavenCentral()
    }
    war {
        baseName = 'services'
        from('resources') {
            include '*.properties'
            into 'WEB-INF/classes/'
        }
    }

    eclipse {
        wtp {
            component {
                contextPath = 'services'
            }
        }
    }
}
  • 写回答

0条回答 默认 最新

    报告相同问题?

    问题事件

    • 系统已结题 10月8日
    • 创建了问题 9月30日

    悬赏问题

    • ¥15 java代码写在记事本上后在cmd上运行时无报错但又没生成文件
    • ¥15 关于#python#的问题:在跑ldsc数据整理的时候一直抱这种错误,要么--out识别不了参数,要么--merge-alleles识别不了参数(操作系统-linux)
    • ¥15 PPOCRLabel
    • ¥15 混合键合键合机对准标识
    • ¥100 现在不懂的是如何将当前的相机中的照片,作为纹理贴图,映射到扫描出的模型上
    • ¥15 魔霸ROG7 pro,win11.息屏后会显示黑屏,如图,如何解决?(关键词-重新启动)
    • ¥15 有没有人知道这是哪里出了问题啊?要怎么改呀?
    • ¥200 C++表格文件处理-悬赏
    • ¥15 Windows Server2016本地登录失败
    • ¥15 复合卡卡号轨道写入芯片卡