【问题标题】:maven plugin dependencies forced to be pluginsmaven插件依赖强制为插件
【发布时间】:2017-03-14 16:50:28
【问题描述】:

我正在制作一个新的 maven 插件。
它基本上只允许发布到本地 maven 存储库的 JAR 中的程序在 maven 生命周期中运行。

因此,插件需要 JAR 并且它被列为依赖项。在目标计算机(没有安装 JAR)中,在 maven 依赖插件执行期间,它将尝试从插件 repo 下载该 JAR。这就是失败的地方。

尝试从存储库下载 JAR 时,使用了错误的 JAR URL。它不是使用 URL 来下载 lib 依赖项,而是使用 URL 来下载插件。

当它作为 maven 插件运行时,如何设置 maven 以便 maven 下载依赖于使用 libs URL 而不是插件 url 的 JAR?

【问题讨论】:

    标签: maven-plugin maven-dependency-plugin


    【解决方案1】:

    尽管如此,maven 插件依赖项并不强制成为插件。真正发生的是在插件存储库中搜索 maven 插件依赖项。

    就我而言,为了解决这个问题,我添加了我在<repositories> 中指定的存储库,并将它们复制到<pluginRepositories> 内部,同时将<repository> 替换为<pluginRepository>

    注意:设置文件位于 ~/.m2/settings.xml%userprofile%\.m2\settings.xml 中,具体取决于操作系统。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-05-12
      • 1970-01-01
      • 1970-01-01
      • 2012-06-30
      • 1970-01-01
      • 2014-07-29
      • 1970-01-01
      • 2019-07-14
      相关资源
      最近更新 更多