gpt4 book ai didi

spring-boot - gradle导入具有传递依赖项的本地jar

转载 作者:行者123 更新时间:2023-12-03 05:42:59 25 4
gpt4 key购买 nike

我在本地$ 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')
}

最佳答案

由于您使用的是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

等等

关于spring-boot - gradle导入具有传递依赖项的本地jar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51595666/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com