maven中非常规的依赖名称
我有一些这样的依赖项。例如: jdic
在我的 pom.xml 中,我定义了一个依赖项
<dependency>
<artifactId>jdic</artifactId>
<groupId>jdic</groupId>
<version>0.8.6</version>
</dependency>
并且我有一个远程存储库(内部服务器):例如 http://repo/thirdparty/< /a> jdic 可以在 http://repo/thirdparty/jdic/jar/jdic.jar 中找到,
如您所见,命名不是传统的 groupId:artifactId:version,而是 jdic.jar,
所以当我运行 maven 编译
mvn clean compile
maven 时告诉我它无法解析依赖项。 我知道我们可以将这些 jar 下载到本地存储库 .m2/repository 并运行,
mvn compile (ie without clean)
并且 jar 不会成为问题。但是有没有其他方法可以让它从远程检索,尽管它的名称非常规并且缺少这些依赖项的元数据/pom 信息?
我已经有一个到这个内部存储库的镜像,它覆盖了中央存储库
I have a few dependencies like this. For example : jdic
In my pom.xml, I defined a dependency
<dependency>
<artifactId>jdic</artifactId>
<groupId>jdic</groupId>
<version>0.8.6</version>
</dependency>
And I have a remote repository (internal server): eg http://repo/thirdparty/
And jdic can be found in http://repo/thirdparty/jdic/jar/jdic.jar
As you notice, the naming is not conventional groupId:artifactId:version, instead its just jdic.jar
so when I run maven compile
mvn clean compile
maven tells me that it cannot resolve dependencies.
I'm aware that we can just download those jars to the local repository .m2/repository and run
mvn compile (ie without clean)
and it the jar will not be a problem. But is there any other way that I can make it retrieve from the remote despite its unconventional name and lack of metadata/pom info for those dependencies?
I already have a mirror to this internal repository that overrides the central
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用版本 (
jdic-0.8.6.jar
) 在内部/镜像存储库中安装 jdic。如果您使用存储库管理器并将 jar 上传到其中,它会自动为其创建一个 pom,并确保按照 Maven 约定使用版本创建依赖项。
You could install the jdic in your internal/mirror repository with the version (
jdic-0.8.6.jar
).If you are using a repository manager and you uploaded the jar to it, it would automagically create a pom for it as well as ensure the dependency was created with version, as per maven convention.
远程 Maven 存储库不是任何以您想要的方式放置文件的 Web 服务器。有很多惯例需要遵循。其中之一是表示版本的方式(这是工件的基本元素之一)。对于您的“远程存储库”,很明显 Maven 无法找到该工件。
设置一个真正的 Maven 远程存储库来托管此类文件。您可以在 Nexus 和 Artifactory 中查看。
A remote Maven repository is NOT any web server putting files in any way you want. There are lots of convention to follow. One of them is the way to represent the version (which is one essential element of an artifact). With your "remote repository" it is clear that there is no way Maven can find the artifact.
Setup a real Maven remote repository to host such files. You can have a look in Nexus and Artifactory.