找不到方法实现()

发布于 2025-02-11 03:57:12 字数 1661 浏览 0 评论 0原文

我知道这是多次问的,但看来我尝试的一切都无法使用。

另外,我是新手,如果我犯了任何错误,我很抱歉。

我尝试使用Gradle和Eclipse构建一个Java罐。

Gradle构建看起来像这样:

plugins {
    id 'org.springframework.boot' version '2.6.2'
    id 'io.spring.dependency-management' version '1.0.11.RELEASE'
}


repositories {
    mavenCentral()
    maven { url 'https://repo.spring.io/milestone' }
    maven { url 'https://repo.spring.io/snapshot' }
}

defaultTasks 'clean', 'bootJar'

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
    implementation 'org.springframework.boot:spring-boot-starter-web'
    implementation 'org.springframework.boot:spring-boot-starter-actuator'
    runtimeOnly 'com.oracle.database.jdbc:ojdbc8'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
}

test {
    useJUnitPlatform()
}

group = 'com.ericsson.opt'
//version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'

但是我总是最终得到:

在类型org.gradle.api.api.internal.artifacts.dsl.deppentencies.defaultDependDepentHandler.

无法找到参数[org.springframework.boot:org.springframework.boot:spring-boot-starter-starter-starter-data-jpa]的方法实现() /p>

现在,如果我使用编译而不是实现,则是同一问题,但使用编译而不是实现。 我正在使用的gradle是:

gradle- version

gradle 7.4.2

构建时间:2022-03-31 15:25:29 UTC 修订:540473B8118064EFCC264694CBCAA4B677F61041

KOTLIN:1.5.31 Groovy:3.0.9 ANT:Apache Ant(TM)版本1.10.11于2021年7月10日汇编 JVM:11.0.15(Oracle Corporation 11.0.15+8-LTS-149) 操作系统:Windows 10 10.0 AMD64

和Gradle的Eclipse插件是BuildShip gradle Integration 3.0

什么可能导致这一点,因为我从以前的搜索中理解它应该与Gradle版本有关,但我认为我在上一个版本上。

谢谢你,

I know this was asked several times over but it looks like everything I try doesn't work.

Also I'm new to this and I am sorry if I make any mistakes.

And I try to build a java jar using Gradle and eclipse.

The Gradle build looks like this:

plugins {
    id 'org.springframework.boot' version '2.6.2'
    id 'io.spring.dependency-management' version '1.0.11.RELEASE'
}


repositories {
    mavenCentral()
    maven { url 'https://repo.spring.io/milestone' }
    maven { url 'https://repo.spring.io/snapshot' }
}

defaultTasks 'clean', 'bootJar'

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
    implementation 'org.springframework.boot:spring-boot-starter-web'
    implementation 'org.springframework.boot:spring-boot-starter-actuator'
    runtimeOnly 'com.oracle.database.jdbc:ojdbc8'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
}

test {
    useJUnitPlatform()
}

group = 'com.ericsson.opt'
//version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'

But I always end up with :

Could not find method implementation() for arguments [org.springframework.boot:spring-boot-starter-data-jpa] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

Now if I use compile instead of implement it is the same problem but with compile instead of implement.
The Gradle I am using is :

Gradle --version

Gradle 7.4.2

Build time: 2022-03-31 15:25:29 UTC
Revision: 540473b8118064efcc264694cbcaa4b677f61041

Kotlin:1.5.31
Groovy:3.0.9
Ant: Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM:11.0.15 (Oracle Corporation 11.0.15+8-LTS-149)
OS: Windows 10 10.0 amd64

And the eclipse plug-in for Gradle is Buildship Gradle Integration 3.0

What can cause this because I understand from previous searches it should be Gradle version related, but I think I'm on my last version.

Thank you,

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

东京女 2025-02-18 03:57:12

您需要首先应用Java插件:

plugins {
  id 'java'
}

Spring Boot的插件仅在Java插件的存在下进行反应,它们不会单独应用插件。

You need to apply the java plugin first:

plugins {
  id 'java'
}

Spring Boot's plugins only react on the presence of the Java plugin, they don't apply the plugin on their own.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文