【问题标题】:Maven: how to check if artifact already installen to local repositoryMaven:如何检查工件是否已安装到本地存储库
【发布时间】:2017-04-06 12:31:20
【问题描述】:

我正在编写一个 shell 脚本,如果它尚未安装,它应该安装一个工件。

是否存在类似mvn install:check artifact-name 的东西?


我正在使用:Apache Maven 3.3.9

【问题讨论】:

  • 运行构建会自动将丢失的工件下载到本地存储库中吗?为什么要为此编写脚本?

标签: maven build-tools


【解决方案1】:

您可以在离线模式中尝试dependenct:get并指定您的存储库,该命令具有以下结构:

mvn dependency:get -Dartifact={groupId}:{artifactId}:{version} -o -DrepoUrl=file://your/repo/path

例如:

mvn dependency:get -Dartifact=junit:junit:4.10 -o -DrepoUrl=file://~/.m2/repository

如果它找到了依赖,那么你会得到:

[INFO] BUILD SUCCESS

【讨论】:

    猜你喜欢
    • 2011-11-26
    • 1970-01-01
    • 1970-01-01
    • 2012-05-20
    • 2010-12-24
    • 2022-11-18
    • 2019-03-09
    • 1970-01-01
    • 2022-08-14
    相关资源
    最近更新 更多