Home > My Work > How to download dependencies sources via Maven

How to download dependencies sources via Maven

You can use the dependency plugin adding this to your pom.xml  (i’ve reported the pom’s build section):

....
<build>

<finalName>booking-mvc</finalName>

<plugins>

<plugin>

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

<artifactId>maven-compiler-plugin</artifactId>

<configuration>

<source>1.5</source>

<target>1.5</target>

</configuration>

</plugin>
<!-- you have to insert this plugin definition-->
<plugin>

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

<artifactId>maven-dependency-plugin</artifactId>

</plugin>

</plugins>

</build>

...
then you can use the command mvn dependency:sources.
The sources will be downloaded into the mvn local repository, together with the dependency itself.
This is very useful with maven modules in intellij idea because it links automatically sources and jars, configuring debugging too.
Advertisements
Categories: My Work
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

%d bloggers like this: