从Maven存储库获取源JAR [英] Get source JARs from Maven repository

查看:236
本文介绍了从Maven存储库获取源JAR的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人知道你是否可以在Maven资源库中找到源JAR?

Does anyone have any idea if you can find source JARs on Maven repositories?

推荐答案


Maven Micro-Tip:获取源代码和Javadocs



当您在IDE中使用Maven时,您经常会发现IDE需要为您的库解析源代码和Javadocs依赖。有一种简单的方法可以实现这个目标。

Maven Micro-Tip: Get sources and Javadocs

When you're using Maven in an IDE you often find the need for your IDE to resolve source code and Javadocs for your library dependencies. There's an easy way to accomplish that goal.

mvn dependency:sources
mvn dependency:resolve -Dclassifier=javadoc

第一个命令将尝试下载pom文件中每个依赖项的源代码。

The first command will attempt to download source code for each of the dependencies in your pom file.

第二个命令将尝试下载Javadoc。

The second command will attempt to download the Javadocs.

Maven受库包装商的支配。因此,其中一些将不会打包源代码,其中许多将不会有Javadoc。

Maven is at the mercy of the library packagers here. So some of them won't have source code packaged and many of them won't have Javadocs.

如果你有很多依赖项,它也可能是一个好的想要使用
包含/排除来获取特定工件,以下命令
将仅使用
a特定工件下载依赖关系的源:

In case you have a lot of dependencies it might also be a good idea to use inclusions/exclusions to get specific artifacts, the following command will for example only download the sources for the dependency with a specific artifactId:

mvn dependency:sources -DincludeArtifactIds=guava


来源: http:/ /tedwise.com/2010/01/27/maven-micro-tip-get-sources-and-javadocs/

文档: https://maven.apache.org/plugins/maven-dependency-plugin/sources -mojo.html

这篇关于从Maven存储库获取源JAR的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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