我有两个jar在本地$ projectDir / lib / a.jar,b.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')
}
由于您使用的是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
等等