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

本小妞迷上赌 提交于 2020-06-28 05:38:30

问题


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

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

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>

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 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.

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?


回答1:


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



来源:https://stackoverflow.com/questions/39278327/how-to-install-dependency-when-jar-name-differs-from-folder-version-name

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!