【发布时间】:2021-05-26 15:58:00
【问题描述】:
我使用 Intellij Idea 创建了一个新的 Spring Boot 应用程序。它依赖于我们自己的一些罐子。我的 Gradle 文件如下所示。
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()
}
我尝试使用添加 jar 文件的依赖项
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')
这种方法已在以前开发的应用程序中起作用。我注意到他们使用的是 Gradle 版本 6.xxx。现在这个新应用的 Gradle 版本是 7.xx。
我收到以下错误:
A problem occurred evaluating root project 'xxxxx'.
> Could not find method compile() for arguments [file collection] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
我该如何解决这个问题?
【问题讨论】:
标签: java spring-boot gradle