File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes IDEs, Version Control and other tools and the fly likes Is it possible to download source code using maven? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "Is it possible to download source code using maven?" Watch "Is it possible to download source code using maven?" New topic
Author

Is it possible to download source code using maven?

Mohana Rao Sv
Ranch Hand

Joined: Aug 01, 2007
Posts: 485

I hope there should be one way to get the source using maven.


ocjp 6 — Feeding a person with food is a great thing in this world. Feeding the same person by transferring the knowledge is far more better thing. The reason is the amount of satisfaction which we get through food is of only one minute or two. But the satisfaction which we can get through the knowledge is of life long.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5779
    
    7

I assume you mean the source code for your dependencies. If the dependency source is deployed to the remote repository, you can get it using the Dependency plugin, specifying that you want the "source" classifers, like this:

mvn dependency:copy-dependencies -Dclassifier=source -Dmdep.failOnMissingClassifierArtifact=false

The sources will be in target/dependency.



JBoss In Action
Mohana Rao Sv
Ranch Hand

Joined: Aug 01, 2007
Posts: 485

Hi Peter, Thanks for your reply but I mean source code is a jar file used to attach to eclipse source code. To know how a particular class is implemented.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5779
    
    7

You never mentioned Eclipse in your original question, so how was I supposed to know? This makes your question one about Eclipse, so I am moving your post.

If you are using m2eclipse, and you have a Maven project, m2eclipse automatically downloads and attaches source JAR files. (Check you project's Build Path, under the Libraries tab expand Maven Dependecnies and then look under each JAR, many of them should have Source Attachment entries - see the attached image.) Of course, the source JARs must be available in the repository for this to work automatically. If there is no source JAR, you can always select Source Attachment, click the Edit button, and then browse to the source location (which you will have to provide yourself).


[Thumbnail for sourcesjars.png]

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Is it possible to download source code using maven?
 
Similar Threads
Maven: What's the big deal?
maven SCM project
Migrating To Maven
Struts2 & XWork
Maven or Ant?