You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

执行Maven Flyway命令时遭遇PluginResolutionException错误求助

问题解决:Maven Flyway命令执行报错Plugin resolution失败

核心错误原因

你执行的命令里存在拼写错误:把-Dflyway.password误写成了-Dlyway.password(缺失字母f)。Maven无法识别这个格式异常的系统参数,错误地将其解析为插件坐标的一部分,进而尝试去Maven中央仓库查找不存在的.url=jdbc:postgresql:jar://localhost插件,最终抛出解析失败的错误。

修正后的命令

将拼写错误的参数修正后,执行以下命令:

../mvnw clean compile -Dflyway.url=jdbc:postgresql://localhost:5431/my_database -Dflyway.user=some_user -Dflyway.password=xxx -Dflyway.outOfOrder=true flyway:migrate -f pom.xml -U -X

额外检查项

如果修正拼写后仍然有问题,可以检查以下内容:

  • 确认pom.xml中已正确配置Flyway Maven插件(若未通过命令直接调用,需确保插件声明存在)
  • 若Flyway插件需要单独依赖PostgreSQL驱动,可在插件的<dependencies>块中添加PostgreSQL依赖(避免依赖作用域导致驱动无法被插件加载):
<build>
  <plugins>
    <plugin>
      <groupId>org.flywaydb</groupId>
      <artifactId>flyway-maven-plugin</artifactId>
      <version>你的Flyway版本</version>
      <dependencies>
        <dependency>
          <groupId>org.postgresql</groupId>
          <artifactId>postgresql</artifactId>
          <version>42.2.19</version>
        </dependency>
      </dependencies>
    </plugin>
  </plugins>
</build>

内容的提问来源于stack exchange,提问作者four-eyes

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.07 16:35:14