博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Download/Attach source-code/java-docs with maven dependencies
阅读量:4958 次
发布时间:2019-06-12

本文共 2130 字,大约阅读时间需要 7 分钟。

I am using Maven in my projects from last couple of years, and the automatically downloading the Jars from repository feature of maven is really helpful for developers. But If you are using Eclipse and want to read/analyse Source Code or Java Doc of API then you need the jar file that contains the Source code and java doc of the API, but unfortunately maven does not download and attach the source code and java doc of the APIs automatically.

Maven provides some different ways to download and attach that source code and Java Doc:

  • Using maven eclipse plugin
  • Using maven dependency plugin

Note: The sources and javadocs of the libraries must exist in the repository so that the plugin can download it and attach it.

1. Maven eclipse plugin:

Maven dependencies that are deployed with the source and javadocs can be downloaded and attached to the Eclipse library by using maven-eclipse-plugin. It can be done by:

  • passing command-line argument to the maven-eclipse-plugin, or
  • by declaring in the pom.xml

1.1 passing command-line argument to maven-eclipse-plugin:

This example shows that how to do this by passing command line argument to the maven-eclipse-plugin:

mvn eclipse:eclipse -DdownloadSources=true -DdownloadJavadocs=true

1.2 declaring in the pom.xml

This sample pom shows that how to declare downloadSources and downloadJavadocs configuration in pom.xml

<project>

<build>

<plugins>

<plugin>

<groupId>org.apache.maven.plugins</groupId>

<artifactId>maven-eclipse-plugin</artifactId>

<configuration>

<downloadSources>true</downloadSources>

<downloadJavadocs>true</downloadJavadocs>

</configuration>

</plugin>

</plgins>

</build>

</project>

2. Maven dependency plugin:

maven-dependency-plugin provides a goal named sources that resolves the project source dependencies from the repository.

usage:

mvn dependency:sources

mvn dependency:resolve -Dclassifier=javadoc

This is useful when you want the source attachments downloaded to your local repository and you don’t want to use the eclipse plugin to do this since the eclipse plugin creates/overwrites the eclipse files.

转载于:https://www.cnblogs.com/sos-blue/p/3515503.html

你可能感兴趣的文章
Java Swing学习
查看>>
HTTP缓存和CDN缓存
查看>>
HDU-1171 Big Event in HDU(生成函数/背包dp)
查看>>
Babel 是干什么的
查看>>
cocos2dx-3.0(8)------Label、LabelTTF、LabelAtlas、LabelBMFont使用之法
查看>>
Mysql数据库乱码总结
查看>>
BZOJ.3160.万径人踪灭(FFT Manacher)
查看>>
CODE[VS] 1842 递归第一次
查看>>
20180418小测
查看>>
Spring Cloud是怎么运行的?
查看>>
12 联结表
查看>>
数字三角形
查看>>
NGUI 减少drawcall规则
查看>>
xss攻击
查看>>
使用Calendar加一天,减一天
查看>>
MVC中AuthorizeAttribute用法并实现权限控制
查看>>
Broken pipe错误终极解释
查看>>
oracle数据库基本命令
查看>>
WLAN热点创建
查看>>
开发环境中快速部署Oracle Essbase(Rapid deployment of oracle essbase in development envrioments)...
查看>>