Maven – Get source code for Jar

In Maven, you can get source code for project dependencies in most IDEs like this :


$ mvn dependency:sources
$ mvn dependency:resolve -Dclassifier=javadoc
  1. Get source code for Jar
  2. Get javadoc for Jar, normally, developers don’t provide this.

1. Eclipse IDE

In Eclipse IDE, it’s better to use the maven eclipse plugin:


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

Or

pom.xml

    <build>
	<plugins>
	  <plugin>
		<groupId>org.apache.maven.plugins</groupId>
		<artifactId>maven-eclipse-plugin</artifactId>
		<configuration>
			<downloadSources>true</downloadSources>
			<downloadJavadocs>false</downloadJavadocs>
		</configuration>
	  </plugin>
	</plugins>
   </build>

About the Author

author image
mkyong
Founder of Mkyong.com, love Java and open source stuff. Follow him on Twitter. If you like my tutorials, consider make a donation to these charities.

Comments

avatar
0 Comment threads
0 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
0 Comment authors
Recent comment authors
newest oldest most voted