为啥我的 Gradle 构建失败并出现“未找到插件 [id: 'org.flywaydb.enterprise.flyway', version: '6.5.0']”错误?
Posted
技术标签:
【中文标题】为啥我的 Gradle 构建失败并出现“未找到插件 [id: \'org.flywaydb.enterprise.flyway\', version: \'6.5.0\']”错误?【英文标题】:Why does my Gradle build fail with a "Plugin [id: 'org.flywaydb.enterprise.flyway', version: '6.5.0'] was not found" error?为什么我的 Gradle 构建失败并出现“未找到插件 [id: 'org.flywaydb.enterprise.flyway', version: '6.5.0']”错误? 【发布时间】:2020-10-22 20:06:33 【问题描述】:当我运行 gradle clean build
时,我收到构建错误消息:
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Users\meno.varghese\git\imc-modulemanager-poc\imc-poc\build.gradle' line: 5
* What went wrong:
Plugin [id: 'org.flywaydb.enterprise.flyway', version: '6.5.0'] was not found in any of the following sources:
- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (could not resolve plugin artifact 'org.flywaydb.enterprise.flyway:org.flywaydb.enterprise.flyway.gradle.plugin:6.5.0')
Searched in the following repositories:
MavenLocal(file:/C:/Users/meno.varghese/.m2/repository)
Gradle Central Plugin Repository
* 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.
我不明白为什么找不到flyway插件。我该如何解决?
这是我的build.gradle
文件:
plugins
id 'org.springframework.boot' version '2.0.0.RELEASE'
id 'io.spring.dependency-management' version '1.0.9.RELEASE'
id 'java'
id "org.flywaydb.enterprise.flyway" version '6.5.0'
apply plugin: "eclipse"
group = 'com.imc.poc'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'
repositories
mavenCentral()
maven
url "https://plugins.gradle.org/m2/"
dependencies
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-web-services'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
implementation "jakarta.xml.bind:jakarta.xml.bind-api:2.3.2"
implementation "org.glassfish.jaxb:jaxb-runtime:2.3.2"
implementation group: 'mysql', name: 'mysql-connector-java', version: '8.0.20'
compile group: 'org.javassist', name: 'javassist', version: '3.27.0-GA'
compile group: 'com.amazonaws', name: 'aws-java-sdk', version: '1.11.808'
flyway
//url = 'jdbc:mysql://localhost:3306/imc_poc?user=root&password=password'
// driver = 'org.postgresql.Driver'
url = 'jdbc:mysql://imc-modulemanager.cwouijqzv1sr.ap-south-1.rds.amazonaws.com:3306'
user = 'admin'
password = 'Indegene12345'
schemas=['moduledb']
【问题讨论】:
你使用的是什么版本的 Gradle 和 Java? 请缩小问题范围并进行描述;不要只是在这里转储你的代码和错误。 当它回答你的问题时不要忘记接受它。 由于您是 Stack Overflow 的新手,我建议您使用 tour,阅读 help center 中的主题内容,然后阅读 How to Ask a Good Question。 【参考方案1】:参考官方Flyway Gradle Plugin documentation page
plugins
id "org.flywaydb.flyway.enterprise" version "6.5.0"
gradle.build
中的插件声明
id "org.flywaydb.enterprise.flyway" version '6.5.0'
完全是错误的,因此找不到。
【讨论】:
以上是关于为啥我的 Gradle 构建失败并出现“未找到插件 [id: 'org.flywaydb.enterprise.flyway', version: '6.5.0']”错误?的主要内容,如果未能解决你的问题,请参考以下文章
FAILURE:构建失败并出现异常。 * 其中:构建文件 'D:\AProjects\flutter_app\android\app\build.gradle' 行:24