如何使用Maven下载jar的源代码? [英] How to download sources for a jar with Maven?

查看:1073
本文介绍了如何使用Maven下载jar的源代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的项目中,我使用的是通过Maven提供的JAR文件。但Maven给我的只是这个罐子 - 没有javadocs,也没有来源。按下下载源没有效果:Eclipse仍然找不到jar的来源。

In my project I am using a JAR file provided via Maven. But what Maven gives me is only this jar - no javadocs and no sources. Pressing "Download Sources" has no effect: Eclipse still does not find the sources of the jar.

这取决于什么?存储库应该自动提供源吗?

What this depends on? Should repository provide sources automatically?

我可能需要在POM中写一些东西来指示Maven下载源代码吗?

May be I need to write something in POM to instruct Maven to download sources?

我目前的pom如下:

<repositories>
    <repository>
        <id>xuggle repo</id>
        <url>http://xuggle.googlecode.com/svn/trunk/repo/share/java/</url>
    </repository>
</repositories>

<dependencies>

    <dependency>
        <groupId>xuggle</groupId>
        <artifactId>xuggle-xuggler</artifactId>
        <version>5.3</version>
        <type>rar</type>
    </dependency>

</dependencies>

为什么Maven没有说任何评论来源下载失败?

Why Maven does not say any comments on it's sources download fail?

推荐答案

执行 mvn依赖:来源将强制maven下载项目中所有jar的所有来源,如果源可用(上载到托管工件的存储库中)。如果你想下载javadoc命令是 mvn依赖:resolve -Dclassifier = javadoc

Executing mvn dependency:sources will force maven to download all sources of all jars in the project, if the sources are available (are uploaded in the repository where the artifact is hosted). If you want to download javadoc the command is mvn dependency:resolve -Dclassifier=javadoc

它也可以创建settings.xml文件中的配置文件,包含以下属性:

It's also possible to create a profile in your settings.xml file and include the following properties:

<properties>
  <downloadSources>true</downloadSources>
  <downloadJavadocs>true</downloadJavadocs>
</properties>

这篇关于如何使用Maven下载jar的源代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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