JAR 名称与文件夹版本名称不同时如何安装依赖项? [英] How to install dependency when JAR name differs from folder version name?

查看:62
本文介绍了JAR 名称与文件夹版本名称不同时如何安装依赖项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm including a dependency from a custom Maven repository. The JAR I want to include is at the URL

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

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

(Not the -h2 at the end; it's important later.)

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

I've included http://mvn.example.org/repositories as a <repository> in my settings.xml, and set up my project's pom.xml to include

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

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

However, when I try to mvn install with this setup, I get

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

immediaqtely 后跟 BUILD FAILURE,因为那不是 JAR 的 URL.请注意,此问题顶部的 实际 URL 具有版本号的 -h2 后缀,而不存在于文件夹版本号中.

immediaqtely followed by a BUILD FAILURE, because that's not the URL of the JAR. Note that the actual URL, at the top of this question, has a -h2 suffix to the version number, not present in the folder version number.

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

Seeing at the default assumption appears to be that the filanme of teh JAR matches the folder name, how can I tell Maven to pull a JAR whose version number filename is different from the containing folder filename?

推荐答案

这是 Maven 分类器.您应该可以使用 h2 指定它.

This is the Maven classifier. You should be able to specify it with <classifier>h2</classifier>.

这篇关于JAR 名称与文件夹版本名称不同时如何安装依赖项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆