如何将第三方jar添加到本地Maven存储库? [英] How do I add third-party jars into local Maven repository?

查看:208
本文介绍了如何将第三方jar添加到本地Maven存储库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个由4个罐组成的库:

I have a library consisting of 4 jars:

matlabcontrol-4.1.0.jar
matlabcontrol-4.1.0-javadoc.jar
matlabcontrol-4.1.0-sources.jar
matlabcontrol-demo-4.1.0.jar

如何将它们添加到本地存储库,以便Maven知道源代码在哪里以及javadoc在哪里?

How do I add them to the local repository so that Maven knows where sources are and where javadoc is?

此处的文档< a href =http://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html =nofollow noreferrer> http://maven.apache.org/guides/mini /guide-3rd-party-jars-local.html 非常简短,不回答这个问题。

Documentation here http://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html is very brief and does not answer this question.

推荐答案

文件明确提到了方法。在C:> location中考虑你的matlabcontrol-4.1.0.jar。因此,将您的cmd移动到C:>位置并运行以下命令。

The documentation clearly mentioned the way. Think your matlabcontrol-4.1.0.jar in C:> location. So move your cmd on C:> location and run following command.

mvn install:install-file -Dfile=matlabcontrol-4.1.0.jar -DgroupId=org.matlabcontrol \
    -DartifactId=matlabcontrol -Dversion=4.1.0 -Dpackaging=jar

如果你这样做,你可以访问你的jar文件,例如:

If you do that, you can access your jar file with dependency, like:

 <dependency>
        <groupId>org.matlabcontrol</groupId>
        <artifactId>matlabcontrol</artifactId>
        <version>4.1.0</version>
 </dependency>

这篇关于如何将第三方jar添加到本地Maven存储库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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