Make Maven to download source

Hello, I'm having problems with Maven in IDEA 7. The built in Maven plugin does not load sources, when a dependency is added to a pom.xml file. However having sources and javadoc could be really important. I have tried using both embedded/external Maven specifying "-DdownloadSources=true -DdownloadJavadocs=true" in Runer tab in Maven properties. Setting download sources in Artifacts tab to "Om Import"/"On Demand". Nothing worked. Does anybody having the same problem? Does anybody know how to setup the plugin to automaticaly download sources for dependencies? Thanks.

6 comments
Comment actions Permalink

downloading sources/javadocs is triggered by the "dowload artifacts" button in the maven tool window, and works for me ... when they exist !

0
Comment actions Permalink

Thanks for reply. Unfortunately download button does not work for me, although IDEA shows during progress that it is downloading sources, they are not even in the repository on the disk (although binaries are downloaded). I have tried with number of projects from Apache Foundation and similar, so I guess sources for these projects are available.

0
Comment actions Permalink

There are lots of open source projects that do not put the src in maven. A work around is to get the sources and associate the src with the maven library.

I think they made a change to the later IJ versions so that they would keep the manual association when you re-import your projects.

0
Comment actions Permalink

Vaclav,

You may try adding the junit:junit:4.0 library to your project and press the 'Download Artifacts' buttons. This library, surely, has javadocs and sources in the repository. After that please check and let me know if the artifacts has been downloaded in the local repository.

Thanks,
Anton Makeev.

0
Comment actions Permalink

Hello Anton,

I have tried adding JUnit 4.0 to a project and downloaded artifacts. The sources and javadoc are downloaded (however it is quite strange that classes are not downloaded, maybe the same problem as with sources before). But it is probably the problem with not all projects having uploaded sources to Maven repositories. Although I'm quite surprised that such projects as TestNG, Apache Lucene etc. without sources and javadocs, as it makes usage of them harder.

Is there any repository with sources for major open source projects, or do I have to upload them manually to my local repository?

BTW: I think it would be great to introduce Maven-inspired dependency management directly to IDEA with some nice GUI, having references to most important repositories, or even some special JetBrains repository. That would be good service for IDEA users. Having full-text search for possible libraries, developer might want to use would be great. This would be great especially for developers new to Java, so they would get vast resources at their fingertips.

0
Comment actions Permalink

Hello Anton,

I have tried adding JUnit 4.0 to a project and downloaded artifacts. The sources and javadoc are downloaded (however it is quite strange that classes are not downloaded, maybe the same problem as with sources before). But it is probably the problem with not all projects having uploaded sources to Maven repositories. Although I'm quite surprised that such projects as TestNG, Apache Lucene etc. without sources and javadocs, as it makes usage of them harder.

Is there any repository with sources for major open source projects, or do I have to upload them manually to my local repository?

BTW: I think it would be great to introduce Maven-inspired dependency management directly to IDEA with some nice GUI, having references to most important repositories, or even some special JetBrains repository. That would be good service for IDEA users. Having full-text search for possible libraries, developer might want to use would be great. This would be great especially for developers new to Java, so they would get vast resources at their fingertips.

0

Please sign in to leave a comment.