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

Timefold迁移Maven命令执行失败,是否存在命令错误?

问题描述

尝试使用Timefold官方提供的Maven命令迁移OptaPlanner项目,多次尝试(包括删除本地Maven仓库、咨询ChatGPT)均失败。项目为Spring Boot微服务架构,OptaPlanner模块独立,执行命令及报错如下:

执行命令:

PS C:\Users\username\Documents\New folder\project-name> mvn org.openrewrite.maven:rewrite-maven-plugin:4.46.0:run -Drewrite.recipeArtifactCoordinates=ai.timefold.solver:timefold-solver-migration:0.8.41 -Drewrite.activeRecipes=ai.timefold.solver.migration.ToLatest

报错信息:

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO] 
[INFO] Project Backend Application                                        [pom]
[INFO] MyProjectBackend                                                   [jar]
[INFO] OptaPlanner                                                        [jar]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for Project Backend Application 1.0.0-DEV:
[INFO] 
[INFO] Project Backend Application ................... SKIPPED
[INFO] MyProjectBackend  ................................ SKIPPED
[INFO] OptaPlanner ........................................ SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.224 s
[INFO] Finished at: 2023-10-24T14:09:44+03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Error resolving version for plugin '.recipeArtifactCoordinates=ai.timefold.solver:timefold-solver-migration' from the repositories [local (C:\Users\username\.m2\repository), central (https://repo.maven.apache.org/maven2)]: Plugin not found in any plugin repository -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginVersionResolutionException
解决方案

错误根源是Maven错误地将命令行参数-Drewrite.recipeArtifactCoordinates解析为插件坐标的一部分,导致无法识别正确的Rewrite插件。可通过以下步骤解决:

  • 在pom.xml中配置Rewrite插件:
    进入独立的OptaPlanner模块目录,修改该模块的pom.xml,添加以下插件配置:

    <build>
        <plugins>
            <plugin>
                <groupId>org.openrewrite.maven</groupId>
                <artifactId>rewrite-maven-plugin</artifactId>
                <version>4.46.0</version>
                <configuration>
                    <activeRecipes>
                        <recipe>ai.timefold.solver.migration.ToLatest</recipe>
                    </activeRecipes>
                    <recipeArtifactCoordinates>ai.timefold.solver:timefold-solver-migration:0.8.41</recipeArtifactCoordinates>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>ai.timefold.solver</groupId>
                        <artifactId>timefold-solver-migration</artifactId>
                        <version>0.8.41</version>
                        <scope>runtime</scope>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </build>
    
  • 执行迁移命令:
    在OptaPlanner模块目录下运行:

    mvn rewrite:run
    
  • 验证依赖可用性:
    确保Maven配置能访问中央仓库,若使用私有仓库需同步配置。执行以下命令强制更新依赖:

    mvn clean install -U
    

内容的提问来源于stack exchange,提问作者Bodea Tudor

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.07 19:55:32