views:

23

answers:

3

I'm developing with Maven Ant Tasks support. When asking the repository to download desired libraries, it also downloads javadoc and source for each library. Is there a way to only download library jars?

Actual build.xml:

<artifact:dependencies settingsFile="${maven.settingsFile}" pomRefId="projectPom"
                       filesetId="dependency.fileset"
                       sourcesFilesetId="sources.dependency.fileset"
                       javadocFilesetId="javadoc.dependency.fileset"
                       versionsId="dependency.versions">
        <remoteRepository refid="remote.repository" />
</artifact:dependencies>
A: 

As far as I know the src and javadoc downloads are off by default. There should be an option in your IDE or whatever tool you use for Maven.

Are your working with Eclipse?
In Eclipse you can find the option here:

Window > Preferences  > Maven

Then tick the checkboxes (or rather untick them) 'Download Artifact Sources/JavaDoc'.

fgysin
@fgysin: I have not Maven plugin installed in Eclipse 'cause I'm working with Maven Ant tasks plugin. Using Maven ant tasks I can take benefit of using Ant and Maven dependencies management.
Esteve Camps
A: 

That's strange. Most open source Maven modules don't have source and javadoc on the default "compile" Maven scope. Have you tried specifying a scope?

<artifact:dependencies filesetId="dependency.fileset" useScope="compile">
..

Alternatively you can also specify a "scope" attribute on each dependency.

Personally I use the ivy plugin for my Maven downloads. The same problem is solved by specifying the "default" or "compile" configuration mapping: http://stackoverflow.com/questions/3654498/ivy-prevent-downloading-sources-and-txt-files/3662697#3662697

Mark O'Connor
@Mark: does not work. Before using Maven Ant tasks, I tried including Ivy on my project, but it's been imposible to tune it (imho, too hard to just take benefit of dependency management)
Esteve Camps
That's a pity, sorry I couldn't be any more help.
Mark O'Connor
A: 

Finally solved: just remove sourcesFilesetId and javadocFilesetId attributes if you don't need sources and javadoc jar libraries.

Esteve Camps