java导入maven项目源码,如何将jar,源代码和Javadoc添加到本地Maven存储库?

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.

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

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)

解决方案

Update: Even though this is the accepted answer, please check the answer of Emmanuel Bourg below - his answer is probably what you would like to do, especially if you're having a snapshot version.

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

For the sources:

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

For the 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

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.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值