gradle导入具有transivite依赖的本地jar

时间:2018-07-30 13:58:29

标签: spring-boot gradle

我在本地$ projectDir / lib / a.jar,b.jar中有两个jar,我需要在gradle构建中添加这两个jar,其中还包括a和b jar的传递依赖项

我的gradle build.gradle文件

buildscript {
    ext {
        springBootVersion = '2.0.3.RELEASE'
    }
    repositories {
        mavenCentral()

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

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

group = 'com.test.c'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8

repositories {
    mavenCentral()
    maven {
    url = file('lib')
    }
}


dependencies {
    compile('org.springframework.boot:spring-boot-starter')
    compile('org.projectlombok:lombok')
    compile('com.test.a:a:0.0.1-SNAPSHOT')
    compile('com.test.b:b:0.0.1-SNAPSHOT')
    testCompile('org.springframework.boot:spring-boot-starter-test')
}

1 个答案:

答案 0 :(得分:0)

由于您使用的是maven()存储库,因此您需要使用maven repository layout约定来存储jar

例如

$projectDir/lib/com/test/a/a/0.0.1-SNAPSHOT/a-0.0.1-SNAPSHOT.jar
$projectDir/lib/com/test/a/a/0.0.1-SNAPSHOT/a-0.0.1-SNAPSHOT.pom
$projectDir/lib/com/test/b/b/0.0.1-SNAPSHOT/b-0.0.1-SNAPSHOT.jar
$projectDir/lib/com/test/b/b/0.0.1-SNAPSHOT/b-0.0.1-SNAPSHOT.pom

相关问题