Maven Flyway插件,Teams Edition,与Cherrypick撤消

发布于 2025-02-01 00:41:54 字数 3429 浏览 3 评论 0 原文

我有一个带有Flyway插件的Maven项目。该项目应使用PostgreSQL数据库测试Flyway的功能。我得到了Teams Edition的TestDrive。我也能够执行每一个飞行目标,也可以撤消。我执行的命令看起来如下 mvn flyway:dusto ,效果很好。
我要执行的内容: mvn flyway:undo -cherrypick = 2 mvn flyway:duno -cherrypick = 1.2

无论如何我都想添加 cherrypick 在我的 pom.xml 文件中,

<configuration>
   <cherryPick>2.0</cherryPick>
</configuration>

我使用:apache-maven 3.6.1

我都会出现以下错误,无论我尝试哪种命令。在为社区版执行飞行目标时,也会发生错误。

...
[ERROR] Failed to execute goal org.flywaydb.enterprise:flyway-maven-plugin:8.5.10:info (default-cli) on project flyway-demo: org.flywaydb.core.api.FlywayException: No matching migrations found for pattern: 2.0 -> [Help 1
]
...

这是我的 pom.xml 文件:

    <dependencies>
        <dependency>
            <groupId>org.flywaydb</groupId>
            <artifactId>flyway-core</artifactId>
            <version>8.5.10</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>sql-maven-plugin</artifactId>
                <version>1.5</version>
            </plugin>
            <plugin>
                <groupId>org.flywaydb.enterprise</groupId>
                <artifactId>flyway-maven-plugin</artifactId>
                <version>8.5.10</version>
                <configuration>
                    <licenseKey>...</licenseKey>
                    <url>Database-url</url>
                    <user>user</user>
                    <password>pw</password>
                    <driver>Database.Driver</driver>
                    <locations>
                        <location>filesystem:src/main/resources/db/migration</location>
                    </locations>
                    <outOfOrder>true</outOfOrder>
                    <cherryPick>1.2</cherryPick>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.postgresql</groupId>
                        <artifactId>postgresql</artifactId>
                        <version>42.2.6</version>
                    </dependency>
                    <dependency>
                        <groupId>postgresql</groupId>
                        <artifactId>postgresql</artifactId>
                        <version>9.1-901-1.jdbc4</version>
                    </dependency>
                </dependencies>

            </plugin>
        </plugins>
    </build>

</project>

我的SQL迁移目录: src-diretory for Migration

我还试图命名诸如:v0__c ...,v1__,v1__a,v1 __a, ..,U0__D ..,USW

有人可以在这里帮我吗?我也已经在 但是什么也没有...

I have a Maven project with the Flyway Plugin. This Project should test the function of Flyway with a PostgreSQL Database. I got the Testdrive for the Teams Edition. I am also able to execute every Flyway-Goal also undo. The commands I execute looks like following mvn flyway:undo and it works fine.
What i want to execute: mvn flyway:undo -cherryPick=2 or mvn flyway:undo -cherryPick=1.2

Anyway when i want to add cherryPick in my pom.xml file with:

<configuration>
   <cherryPick>2.0</cherryPick>
</configuration>

I use: apache-maven 3.6.1

I got following Error, no matter which command i try. Error also occurs when executing Flyway-Goals for Community Edition.

...
[ERROR] Failed to execute goal org.flywaydb.enterprise:flyway-maven-plugin:8.5.10:info (default-cli) on project flyway-demo: org.flywaydb.core.api.FlywayException: No matching migrations found for pattern: 2.0 -> [Help 1
]
...

Here my pom.xml file:

    <dependencies>
        <dependency>
            <groupId>org.flywaydb</groupId>
            <artifactId>flyway-core</artifactId>
            <version>8.5.10</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>sql-maven-plugin</artifactId>
                <version>1.5</version>
            </plugin>
            <plugin>
                <groupId>org.flywaydb.enterprise</groupId>
                <artifactId>flyway-maven-plugin</artifactId>
                <version>8.5.10</version>
                <configuration>
                    <licenseKey>...</licenseKey>
                    <url>Database-url</url>
                    <user>user</user>
                    <password>pw</password>
                    <driver>Database.Driver</driver>
                    <locations>
                        <location>filesystem:src/main/resources/db/migration</location>
                    </locations>
                    <outOfOrder>true</outOfOrder>
                    <cherryPick>1.2</cherryPick>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.postgresql</groupId>
                        <artifactId>postgresql</artifactId>
                        <version>42.2.6</version>
                    </dependency>
                    <dependency>
                        <groupId>postgresql</groupId>
                        <artifactId>postgresql</artifactId>
                        <version>9.1-901-1.jdbc4</version>
                    </dependency>
                </dependencies>

            </plugin>
        </plugins>
    </build>

</project>

My directory for the SQL-Migrations:
src-diretory for migration

I also tried to name the versions like: V0__C..., V1__A..,U0__D.., usw

Can someone help me out here? I look also already alot on https://flywaydb.org/documentation/configuration/parameters/
but found nothing...

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

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

发布评论

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

评论(3

我的黑色迷你裙 2025-02-08 00:41:55

您收到的错误表明您没有v2.0的迁移文件:找不到用于模式的匹配迁移:2.0

如果我查看您的图像,则可用的迁移文件为v1.0到v1.3。
这些值中的任何一个都应起作用。

如果要通过Maven Commandline提供 CherryPick 值,则必须像这样提供它们: mvn flyway:undo -dflyway.cherrypick = 1.3

=“ https://flywaydb.org/documentation/usage/maven/” rel =“ nofollow noreferrer”> https://flywaydb.org/documentation/usage/maven/maven/

代码>位置通过添加以下选项:

<configuration>
    <failOnMissingLocations>true</failOnMissingLocations>
</configuration>

参考:

The error you're getting indicates that you have no migration file for V2.0: No matching migrations found for pattern: 2.0

If i look at your image, the migration files you have available are V1.0 to V1.3.
Any of those values should work.

If you want to provide the cherryPick value via the Maven commandline, you have to provide them like so: mvn flyway:undo -Dflyway.cherryPick=1.3

See: https://flywaydb.org/documentation/usage/maven/

You can also check if your provided location for the migration files is correct by adding the following option:

<configuration>
    <failOnMissingLocations>true</failOnMissingLocations>
</configuration>

References:

残龙傲雪 2025-02-08 00:41:55

感谢您的回答。
我想出了类似的方式,但我仍然不满意。
目前,它对我的​​pom.xml脚本中的占位符变量对我来说很适合。

我现在理解的缺失模式。我关注的是,版本命名者很合适。因此解决了这些问题。

我在pom.xml文件中添加了这两个部分:

<properties>
        <maven.compiler.source>11</maven.compiler.source>
        <maven.compiler.target>11</maven.compiler.target>
        <flyway.cherryPick>${CHERRY_PICK_VERSION}</flyway.cherryPick>
</properties>

然后

<configuration>
    <cherryPick>{flyway.cherryPick}</cherryPick>
</configuration>

我可以将MVN传递给Cherrypick的值。我的命令看起来像这样: mvn -dcherry_pick_version =“ 2” flyway:dusto ,但我不想给maven在pom.xml中设置它的值。

我想将Cherrypick版本传递给Flyway。因此,当我只需要 mvn flyway:info 时,我不必将每个命令传递我的cherry_pick_version。使用Cherrpick的命令应该喜欢: MVN Flyway:duno -dflyway.CherryPick = 2 。在有和没有标志的情况下,这两个命令都应该是可能的。

我已经尝试将Cherrypick配置从我的pom.xml中切出,并尝试了命令:
MVN Flyway:撤消-dflyway.cherrypick = 2 &amp; mvn -dflyway.CherryPick = 2 Flyway:dusto
PS:版本命名器现在为0,1,2,3。

的错误

[ERROR] Unknown lifecycle phase ".cherryPick=2". You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available life
cycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-te
st-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post
-site, site-deploy. -> [Help 1]

两者都发生在飞行范围内窗口中 本身中的效果非常好。但是我也希望它也可以与MVN命令一起使用。
我不希望您需要下载额外的飞行,以供命令窗口。取而代之的是,我想为我的MavenProject下载插件,并用Maven执行飞行目标。

thanks for your answer.
i figured out a similar way, but i am still not satisfied.
Currently it works for me with a placeholder variable in my pom.xml script.

The missing Pattern i understand now. I watched out for this, that the versionnumbers are fitting. So these Problem is solved.

I add these 2 Parts in my pom.xml file:

<properties>
        <maven.compiler.source>11</maven.compiler.source>
        <maven.compiler.target>11</maven.compiler.target>
        <flyway.cherryPick>${CHERRY_PICK_VERSION}</flyway.cherryPick>
</properties>

and

<configuration>
    <cherryPick>{flyway.cherryPick}</cherryPick>
</configuration>

Then i can pass mvn the value of the cherryPick. My Command looks like that: mvn -DCHERRY_PICK_VERSION="2" flyway:undo , but i dont want to give maven the value to set it fix in the pom.xml.

I want to pass the cherryPick versions to flyway. So i dont have to pass in every command my CHERRY_PICK_VERSION when i want just mvn flyway:info for example. The command with using cherrPick should like that then: mvn flyway:undo -Dflyway.cherryPick=2. Both commands should be possible, with and without the flag.

I tried already to cut the cherryPick configurations out of my pom.xml and tried the commands:
mvn flyway:undo -Dflyway.cherryPick=2 & mvn -Dflyway.cherryPick=2 flyway:undo
PS: Versionnumers are 0,1,2,3 now.

Both occurs following Error

[ERROR] Unknown lifecycle phase ".cherryPick=2". You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available life
cycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-te
st-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post
-site, site-deploy. -> [Help 1]

In the flyway-commandwindow itselfs works perfectly fine. But i want it to work with mvn-command too.
I dont want that u need to download extra Flyway, for the command-window. Instead i want to download it with a plugin for my Mavenproject and execute the flyway goals with Maven.

一刻暧昧 2025-02-08 00:41:55

我能够修复它!不再需要任何支持!谢谢:)

I was able to fix it! Dont need any support anymore! Thanks:)

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