在子项目中找不到参数的方法实现

时间:2019-02-22 15:13:40

标签: gradle

我有一个看起来像这样的多项目版本

talepath-poc-1
    talepath-poc-1-backend
        build.gradle
    talepath-poc-1-ui
        build.gradle
    build.gradle
    settings.gradle

settings.gradle

rootProject.name = 'talepath-poc-1'

include 'talepath-poc-1-backend'
include 'talepath-poc-1-ui'

talepath-poc-1

plugins {
    id 'java'
}

group = 'com.lapots.breed'

allprojects {
    group = 'com.lapots.breed'
}

subprojects {
    version = '1.0-SNAPSHOT'
    repositories {
        jcenter()
    }
}

talepath-poc-1-ui

plugins {
    id 'org.gretty' version '2.3.1'
    id 'com.devsoap.vaadin-flow' version '1.0.0.RC8'
}

repositories {
    vaadin.repositories()
}

dependencies {
    implementation project(":talepath-poc-1-backend")

    implementation vaadin.core()
    implementation vaadin.servletApi()
    implementation vaadin.slf4j()

    implementation "org.hibernate:hibernate-validator:5.4.1.Final"

    implementation "org.vaadin.pekka:checkbox-group-java:1.0.0.alpha1"
    implementation "javax.validation:validation-api:2.0.1.Final"
}

vaadin {
    productionMode = true
}

talepath-poc-1-backend

dependencies {
    implementation "javax.validation:validation-api:1.1.0.Final"
    implementation "junit:junit:4.11"
}

但是无论我放入talepath-poc-1-backend项目中有什么依赖性,对于任何依赖性,它总是会失败,并且具有相同的例外情况

 Could not find method implementation() for arguments [*dependency*] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

虽然talepath-poc-1-ui工作正常。有什么问题吗?

1 个答案:

答案 0 :(得分:1)

您仅在根项目中应用了java插件。

将其应用于所有子项目(我认为将其保留在根项目中是没有用的):

subprojects {
    plugins {
        id 'java'
    }
}