[英]How to add a jar, source and Javadoc to the local Maven repository?
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. 我想添加最新版本的JGoodies Forms(1.5.0)作为依赖项,但我在主存储库中找不到比1.0.5更新的东西,所以如果我理解正确,那么我能做的下一个最好的事情do是将它添加到我的本地存储库。
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). 当我从网站上下载它时,我得到一个ZIP文件,其中包含javadoc文件,源代码和jar(只包含类文件)。
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? 将这个添加到我的本地Maven存储库的过程是什么,以便Eclipse能够看到源代码和Javadoc? (I've only just started using Maven)
(我刚刚开始使用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. 更新 : 即使这是接受的答案,请查看下面的Emmanuel Bourg的答案 - 他的回答可能就是你想要做的,特别是如果你有快照版本。
You can use the maven deploy plugin for that. 您可以使用maven部署插件。 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: 对于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. 请注意,这将生成标准POM,因此您不会自动提取JGoodies(如果有)的依赖项,但必须在项目中手动指定它们。
Here is the syntax to deploy the binary, the sources and the javadoc with a single command: 以下是使用单个命令部署二进制文件,源代码和javadoc的语法:
mvn deploy:deploy-file \
-DgroupId=com.jgoodies \
-DartifactId=jgoodies-forms \
-Dversion=1.6.0 \
-Dfile=jgoodies-forms-1.6.0.jar \
-Dsources=jgoodies-forms-1.6.0-sources.jar \
-Djavadoc=jgoodies-forms-1.6.0-javadoc.jar \
-Durl=file://path/to/your/local/repository
Install the jar you have downloaded using this mini guide : 使用此迷你指南安装您下载的jar:
http://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html http://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html
You should install jgoodies-form-1.5.0.jar by typing: 你应该输入以下命令安装jgoodies-form-1.5.0.jar:
mvn install:install-file -Dfile=<path-to-file>/jgoodies-form-1.5.0.jar \
-DgroupId=jgoodies -DartifactId=forms -Dversion=1.5.0 -Dpackaging=jar
don't forget to do the same with jgoodies-commons. 别忘了和jgoodies-commons一样。
For you to be able to access the source code and the contextual javadoc you can either 为了能够访问源代码和上下文javadoc,您也可以
uncompress the jgoodies form zip and make eclipse points to the src folder 解压缩jgoodies表单zip并将eclipse指向src文件夹
generates a jgoodies-form-1.5.0-src.jar by putting the src directory in it and install it in your local repo the same way you did for the jar 生成一个jgoodies-form-1.5.0-src.jar,将src目录放入其中并将其安装在本地repo中,就像你对jar一样
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.