Gradle Multi Module产品:依赖于另一个的编译模块

时间:2017-12-14 06:12:39

标签: java maven gradle

我来自Maven工作,是Gradle的新手。我有多模块Gradle产品,包括以下模块:

"cdna-common"
'cdna-data-access'
"cdna-api-dto"
"cdna-api-module"
"cdna-request-executor-module"

enter image description here

我的root settings.glade 如下所示:

rootProject.name = 'cdna-one-platform'

include "cdna-common"
include 'cdna-data-access'
//include "cdna-api-dto" //commented temporary
include "cdna-api-module"
//include "cdna-request-executor-module" //commented temporary

模块的gradle文件' cdna-data-access '是:

buildscript {
    ext {
        springBootVersion = '2.0.0.M6'
    }
    repositories {
        mavenCentral()
        maven { url "https://repo.spring.io/snapshot" }
        maven { url "https://repo.spring.io/milestone" }
    }

    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
    }

}

ext['hibernate.version'] = '5.2.11.Final'

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'

group = 'com.company.cdna'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8

jar {
    baseName = 'cdna-one-data-access'
}

repositories {
    mavenCentral()
    maven { url "https://repo.spring.io/snapshot" }
    maven { url "https://repo.spring.io/milestone" }
}
a

dependencies {
    compile('org.springframework.boot:spring-boot-starter')
    compile('mysql:mysql-connector-java')
    compile('org.springframework.boot:spring-boot-starter-data-jpa')
    compile('org.hibernate:hibernate-search-orm')
    compile group: 'org.hibernate', name: 'hibernate-search-orm' , version: '5.8.2.Final'
    compile group: 'org.apache.lucene', name: 'lucene-analyzers-kuromoji' , version: '5.5.5'
    testCompile('org.springframework.boot:spring-boot-starter-test')
    testCompile('com.h2database:h2')
}

模块' cdna-common '取决于' cdna-one-data-access '和gradle文件看起来像:

apply plugin: 'java'
apply plugin: 'eclipse'

group = 'com.company.cdna'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8

jar {
    baseName = 'cdna-one-commons'
}

repositories {
    mavenCentral()
    maven { url "https://repo.spring.io/snapshot" }
    maven { url "https://repo.spring.io/milestone" }

}

dependencies {
    compile project(':cdna-data-access')
}

当我编译模块时,无论如何,cess'使用' gradlew cdna-data-access:build ' ,它编译没有任何错误。

但是,当我尝试编译模块时,cdna-common'使用' gradlew cdna-common:build ' ,它给出了以下错误:

FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all files for configuration ':cdna-common:compileClasspath'.
> Could not find org.springframework.boot:spring-boot-starter:.
  Searched in the following locations:
      https://repo1.maven.org/maven2/org/springframework/boot/spring-boot-starter//spring-boot-starter-.pom
      https://repo1.maven.org/maven2/org/springframework/boot/spring-boot-starter//spring-boot-starter-.jar
      https://repo.spring.io/snapshot/org/springframework/boot/spring-boot-starter//spring-boot-starter-.pom
      https://repo.spring.io/snapshot/org/springframework/boot/spring-boot-starter//spring-boot-starter-.jar
      https://repo.spring.io/milestone/org/springframework/boot/spring-boot-starter//spring-boot-starter-.pom
      https://repo.spring.io/milestone/org/springframework/boot/spring-boot-starter//spring-boot-starter-.jar
  Required by:
      project :cdna-common > project :cdna-data-access
> Could not find mysql:mysql-connector-java:.
  Searched in the following locations:
      https://repo1.maven.org/maven2/mysql/mysql-connector-java//mysql-connector-java-.pom
      https://repo1.maven.org/maven2/mysql/mysql-connector-java//mysql-connector-java-.jar
      https://repo.spring.io/snapshot/mysql/mysql-connector-java//mysql-connector-java-.pom
      https://repo.spring.io/snapshot/mysql/mysql-connector-java//mysql-connector-java-.jar
      https://repo.spring.io/milestone/mysql/mysql-connector-java//mysql-connector-java-.pom
      https://repo.spring.io/milestone/mysql/mysql-connector-java//mysql-connector-java-.jar
  Required by:
      project :cdna-common > project :cdna-data-access
> Could not find org.springframework.boot:spring-boot-starter-data-jpa:.
  Searched in the following locations:
      https://repo1.maven.org/maven2/org/springframework/boot/spring-boot-starter-data-jpa//spring-boot-starter-data-jpa-.pom
      https://repo1.maven.org/maven2/org/springframework/boot/spring-boot-starter-data-jpa//spring-boot-starter-data-jpa-.jar
      https://repo.spring.io/snapshot/org/springframework/boot/spring-boot-starter-data-jpa//spring-boot-starter-data-jpa-.pom
      https://repo.spring.io/snapshot/org/springframework/boot/spring-boot-starter-data-jpa//spring-boot-starter-data-jpa-.jar
      https://repo.spring.io/milestone/org/springframework/boot/spring-boot-starter-data-jpa//spring-boot-starter-data-jpa-.pom
      https://repo.spring.io/milestone/org/springframework/boot/spring-boot-starter-data-jpa//spring-boot-starter-data-jpa-.jar
  Required by:
      project :cdna-common > project :cdna-data-access

我做错了什么提示?

0 个答案:

没有答案