我使用 Intellij Idea 创建了一个新的 Spring Boot 应用程序。它依赖于我们自己的一些 Jars。我的 Gradle 文件看起来像这样。
cau_cat
我尝试使用
添加jar文件的依赖项plugins {
id 'org.springframework.boot' version '2.5.0'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'java'
}
group = 'com.company'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenCentral()
}
dependencies {
compile files('lib/Common.jar')
compile files('lib/ConnectionManager.jar')
compile files('lib/LogManager.jar')
compile files('lib/Licensing.jar')
compile files('lib/Messaging.jar')
compile files('lib/Communication.jar')
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.boot:spring-boot-starter-data-jdbc'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-data-mongodb'
implementation 'org.springframework.boot:spring-boot-starter-data-rest'
implementation 'org.springframework.boot:spring-boot-starter-jdbc'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-web'
compileOnly 'org.projectlombok:lombok'
runtimeOnly 'com.h2database:h2'
runtimeOnly 'com.microsoft.sqlserver:mssql-jdbc'
runtimeOnly 'com.oracle.database.jdbc:ojdbc8'
runtimeOnly 'mysql:mysql-connector-java'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.security:spring-security-test'
}
test {
useJUnitPlatform()
}
这种方法适用于之前开发的应用程序。我注意到他们使用的是 Gradle 版本 6.xxx。现在这款新应用的 Gradle 版本为 7.xx。
我收到以下错误:
compile files('lib/Common.jar')
compile files('lib/ConnectionManager.jar')
compile files('lib/LogManager.jar')
compile files('lib/Licensing.jar')
compile files('lib/Messaging.jar')
compile files('lib/Communication.jar')
我该如何解决这个问题?
答案 0 :(得分:1)
compile
配置已经弃用了一段时间,并在 Gradle 7 中被删除。您应该改用 implementation
。