如何将jar,源代码和Javadoc添加到本地Maven存储库? [英] How to add a jar, source and Javadoc to the local Maven repository?

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

问题描述

我想添加最新版本的JGoodies Forms(1.5.0)作为依赖项,但是我在主存储库中找不到比1.0.5更新的任何内容,因此,如果我理解正确的话,倒数第二个是最好的我可以做的就是将其添加到本地存储库中.

I'm wanting to add the latest version of JGoodies Forms (1.5.0) as a dependency, but I can't find anything newer than 1.0.5 in the main repository, so if I understand correctly, the next best thing I can do is add it to my local repository.

从网站上下载时,我得到一个ZIP文件,其中包含javadoc文件,源代码和jar(仅包含类文件).

When I download it from the website, I get a ZIP file that contains the javadoc files, the source code and the jar (with just class files in it).

以某种方式将其添加到本地Maven存储库中以使Eclipse能够看到源代码和Javadoc的过程是什么? (我才刚刚开始使用Maven)

What is the procedure for adding this to my local Maven repository in such a way that Eclipse will be able to see the source and Javadoc? (I've only just started using Maven)

推荐答案

更新:即使这是公认的答案,也请在下面查看伊曼纽尔·布尔格的答案-他的答案可能是您想做的事情,尤其是当您使用快照版本时.

您可以为此使用Maven部署插件.它的目标是将单个文件部署到任何存储库. 对于罐子本身:

You can use the maven deploy plugin for that. It has a goal for deploying a single file to any repository. For the jar itself:

mvn deploy:deploy-file \
    -DgroupId=com.yourname.jgoodies \
    -DartifactId=jgoodies-forms \
    -Dversion=1.50 \
    -Dfile=/path/to/jgoodies-1.50.jar \
    -Dpackaging=jar \
    -Durl=file://path/to/your/local/repository 

对于来源:

mvn deploy:deploy-file \
    -DgroupId=com.yourname.jgoodies \
    -DartifactId=jgoodies-forms \
    -Dversion=1.50 \
    -Dfile=/path/to/jgoodies-sources.jar \
    -Dpackaging=jar \
    -Durl=file://path/to/your/local/repository \
    -Dclassifier=sources

对于Javadoc:

mvn deploy:deploy-file \
    -DgroupId=com.yourname.jgoodies \
    -DartifactId=jgoodies-forms \
    -Dversion=1.50 \
    -Dfile=/path/to/jgoodies-javadoc.jar \
    -Dpackaging=jar \
    -Durl=file://path/to/your/local/repository \
    -Dclassifier=javadoc

请注意,这将生成一个标准的POM,因此您不会自动提取JGoodies(如果有)的依赖项,而必须在项目中手动指定它们.

Note that this will generate a standard POM, so you won't have the dependencies of JGoodies (if any) pulled automatically but have to specify them manually in your project.

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

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