2

I am using specific jar library, provided via Maven vendor-specific repository. There is only jar file in the repository, i.e. no sources and no javadocs.

But I know, that sources are available online, in SVN repository. Can I tell Maven to download sources of specific JAR from specific SVN location and may be from specific revision number?

Suzan Cioc
  • 29,281
  • 63
  • 213
  • 385
  • If they are not too many libraries.. you may need to download manually copy them to local `.m2` folder structure.. – RP- Jul 06 '12 at 12:03
  • @Rp: This is generally not a good idea, as the build will not be portable (reproducible) on another machine. You need to add the artifacts in some sort of central repository (like a company-wide artifact manager such as Nexus / Artifactory / etc). – carlspring Jul 06 '12 at 12:06

4 Answers4

2

No you can't tell maven to download sources from a SVN repository. Maven expects all kinds of artifacts within the appropriate Maven repository.

khmarbaise
  • 92,914
  • 28
  • 189
  • 235
0

What you can do is to tell Maven in which Repository to look for the libraries including the resources. If the sources are not available in a Maven repostory format, you can tell your IDE (e.g. Eclipse) to link them directly from a location on your hard disk.

adranale
  • 2,835
  • 1
  • 21
  • 39
0

Jars are not stored in SVN repositories, they're stored in artifact repositories when working with Maven. Keeping binary artifacts (such as jar files) under version control is considered bad practice.

If you would like to check if a certain artifact produces a sources or javadoc artifact which is available via Maven Central, then you can check in:

If you have your own Maven repository (such as Nexus, Artifactory), etc, you can use it as well.

If I understand you correctly, your problem is that the sources for these artifacts are not being displayed in your IDE. If this is the case and you are sure they produce source/javadoc artifacts, then you can set up your IDE to resolve these dependencies.

If you're using Eclipse, you will need something along the lines of:

<project ...>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-eclipse-plugin</artifactId>
                <version>2.9</version>
                <configuration>
                    <downloadSources>true</downloadSources>
                    <downloadJavadocs>true</downloadJavadocs>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
carlspring
  • 31,231
  • 29
  • 115
  • 197
0

In the pom.xml file you have to set the dependencies, for example:

<dependency>
         <groupId> junit </ groupId>
         <artifactId> junit </ artifactId>
         <scope> test </ scope>
         <version> 4.10 </ version>
</ dependency>

I think you can not see it for revisions, look for the libraries including the resources and dependencies of pom.xml.

A. M. Mérida
  • 2,458
  • 3
  • 18
  • 24