找不到Flyway maven插件

时间:2014-12-05 22:56:04

标签: maven maven-plugin flyway

在我的pom.xml中,我有:

 <plugin>
    <groupId>org.flywaydb</groupId>
    <artifactId>flyway-maven-plugin</artifactId>
    <version>3.1</version>
    <configuration></configuration>
 </plugin>

测试插件,我正在做:

mvn flyway:migrate

但是我收到了一个错误:

[ERROR] No plugin found for prefix 'flyway' in the current project and in the pl
ugin groups [org.wildfly.plugins, org.flywaydb.plugins, org.apache.maven.plugins
, org.codehaus.mojo] available from the repositories [local (C:\Users\me\.
m2\repository), central (https://repo.maven.apache.org/maven2)] -> [Help 1]

我的pom中缺少什么? flyway插件位于中央。

2 个答案:

答案 0 :(得分:3)

您应该在项目类路径中运行mvn compile flyway:migrate

假设您的项目名称栏存储在C:\project目录中。

  • 您应该打开命令提示符并将更改目录更改为C:\project\bar
  • 然后,运行mvn compile flyway:migrate而不是mvn flyway:migrate

另见First Steps: flywaydb with Maven

答案 1 :(得分:2)

在我的情况下它说:DataSource没有设置!检查你的配置! 你应该填写配置标签:

<plugin>
        <groupId>org.flywaydb</groupId>
        <artifactId>flyway-maven-plugin</artifactId>
        <version>4.0.1</version>
        <configuration>
            <url>jdbc:h2:file:./target/foobar</url>
            <user>sa</user>
        </configuration>
        <dependencies>
            <dependency>
                <groupId>com.h2database</groupId>
                <artifactId>h2</artifactId>
                <version>1.4.191</version>
            </dependency>
        </dependencies>
    </plugin>