Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/bash/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Gradle多模块项目无法解析依赖子模块的类_Gradle_Groovy_Dependencies_Multi Module - Fatal编程技术网

Gradle多模块项目无法解析依赖子模块的类

Gradle多模块项目无法解析依赖子模块的类,gradle,groovy,dependencies,multi-module,Gradle,Groovy,Dependencies,Multi Module,该应用程序在Eclipse中运行良好。但是我无法通过gradle构建应用程序(GradleClean build) 结构如下: 财务计算器(母公司) 库 api api想要使用库的类 我父母的设置.gradle文件: rootProject.name = 'financial-calculator' include 'library' include 'api' rootProject.children.each { it.name = rootProject.name + '-'

该应用程序在Eclipse中运行良好。但是我无法通过gradle构建应用程序(
GradleClean build

结构如下:

财务计算器
(母公司)

  • api
api
想要使用
库的类

我父母的
设置.gradle
文件:

rootProject.name = 'financial-calculator'

include 'library'
include 'api'  

rootProject.children.each { it.name = rootProject.name + '-' + it.name }
buildscript {
    ext {
        springBootVersion = '2.0.3.RELEASE'
    }
    repositories {
        mavenLocal()
        mavenCentral()
    }
    dependencies {
        classpath "o.s.b:spring-boot-gradle-plugin:${springBootVersion}"
    }
}

allprojects {
    apply plugin: 'eclipse'
    apply plugin: 'maven'
    apply plugin: 'maven-publish'

    group = 'net.hemisoft.financial.calculator'
    version = "0.1.0-SNAPSHOT"
}

subprojects {
    apply plugin: 'groovy'
    apply plugin: 'org.springframework.boot'
    apply plugin: 'io.spring.dependency-management'

    sourceCompatibility = JavaVersion.VERSION_1_8

    repositories {
        mavenLocal()
        mavenCentral()
    }

    dependencies {
        compile 'o.c.g:groovy'
        testCompile 'o.s.b:spring-boot-starter-test'
    }

    dependencyManagement {
        imports { mavenBom("o.s.b:spring-boot-dependencies:${springBootVersion}") }
    }
}

project(rootProject.name + '-library') {
    dependencies {
        compile 'o.s.b:spring-boot-starter'
    }
}

project(rootProject.name + '-api') {
    dependencies {
        compile project (':' + rootProject.name + '-library')
        compile 'o.s.b:spring-boot-starter-web'
    }
}
父级
build.gradle
文件:

rootProject.name = 'financial-calculator'

include 'library'
include 'api'  

rootProject.children.each { it.name = rootProject.name + '-' + it.name }
buildscript {
    ext {
        springBootVersion = '2.0.3.RELEASE'
    }
    repositories {
        mavenLocal()
        mavenCentral()
    }
    dependencies {
        classpath "o.s.b:spring-boot-gradle-plugin:${springBootVersion}"
    }
}

allprojects {
    apply plugin: 'eclipse'
    apply plugin: 'maven'
    apply plugin: 'maven-publish'

    group = 'net.hemisoft.financial.calculator'
    version = "0.1.0-SNAPSHOT"
}

subprojects {
    apply plugin: 'groovy'
    apply plugin: 'org.springframework.boot'
    apply plugin: 'io.spring.dependency-management'

    sourceCompatibility = JavaVersion.VERSION_1_8

    repositories {
        mavenLocal()
        mavenCentral()
    }

    dependencies {
        compile 'o.c.g:groovy'
        testCompile 'o.s.b:spring-boot-starter-test'
    }

    dependencyManagement {
        imports { mavenBom("o.s.b:spring-boot-dependencies:${springBootVersion}") }
    }
}

project(rootProject.name + '-library') {
    dependencies {
        compile 'o.s.b:spring-boot-starter'
    }
}

project(rootProject.name + '-api') {
    dependencies {
        compile project (':' + rootProject.name + '-library')
        compile 'o.s.b:spring-boot-starter-web'
    }
}
您将在下面找到完整的小项目

谢谢你的提示