当 JAR 名称与文件夹版本名称不同时如何安装依赖项?

How to install dependency when JAR name differs from folder version name?

我正在包含来自自定义 Maven 存储库的依赖项。我要包含的 JAR 位于 URL

http://mvn.example.org/repositories/org/apache/foo/foo/1.2.3-4/1.2.3-4-h2.jar

(不是最后的-h2;后面很重要。)

我已将 http://mvn.example.org/repositories 作为 <repository> 包含在我的 settings.xml 中,并将我的项目 pom.xml 设置为包含

<dependencies>
    <dependency>
        <groupId>org.apache.foo</groupId>
        <artifactId>foo</artifactId>
        <version>1.2.3-4</version>
    </dependency>
...
</dependencies>

但是,当我尝试使用此设置 mvn install 时,我得到

Downloading: http://mvn.example.org/repositories/org/apache/foo/foo/1.2.3-4/1.2.3-4.jar

紧接着是 BUILD FAILURE,因为那不是 JAR 的 URL。请注意,此问题顶部的 actual URL 版本号有一个 -h2 后缀,不存在于文件夹版本号中。

看到默认假设似乎是 JAR 的文件与文件夹名称匹配,我如何告诉 Maven 提取版本号文件名与包含文件夹文件名不同的 JAR?

这是Maven classifier。您应该能够使用 <classifier>h2</classifier>.

指定它