Index: src/main/java/org/apache/maven/artifact/ant/DependenciesTask.java
===================================================================
--- src/main/java/org/apache/maven/artifact/ant/DependenciesTask.java (revision 591982)
+++ src/main/java/org/apache/maven/artifact/ant/DependenciesTask.java (working copy)
@@ -72,6 +72,8 @@
private String sourcesFilesetId;
+ private String javadocsFilesetId;
+
private String versionsId;
private String useScope;
@@ -212,6 +214,12 @@
FileSet sourcesFileSet = new FileSet();
sourcesFileSet.setDir( sourcesFileList.getDir( getProject() ) );
+ FileList javadocsFileList = new FileList();
+ javadocsFileList.setDir( getLocalRepository().getPath() );
+
+ FileSet javadocsFileSet = new FileSet();
+ javadocsFileSet.setDir( javadocsFileList.getDir( getProject() ) );
+
Set versions = new HashSet();
if ( result.getArtifacts().isEmpty() )
@@ -266,6 +274,38 @@
}
}
}
+
+ if ( javadocsFilesetId != null )
+ {
+ log( "Resolving dependencies javadocs...", Project.MSG_VERBOSE );
+ // get sources
+ Artifact javadocsArtifact =
+ artifactFactory.createArtifactWithClassifier( artifact.getGroupId(), artifact.getArtifactId(),
+ artifact.getVersion(), "java-source", "javadoc" );
+ if ( javadocsArtifact != null )
+ {
+ try
+ {
+ resolver.resolve( javadocsArtifact, remoteArtifactRepositories, localRepo );
+ String javadocsFilename = localRepo.pathOf( javadocsArtifact );
+
+ FileList.FileName javadocsFile = new FileList.FileName();
+ javadocsFile.setName( javadocsFilename );
+
+ javadocsFileList.addConfiguredFile( javadocsFile );
+
+ javadocsFileSet.createInclude().setName( javadocsFilename );
+ }
+ catch ( ArtifactResolutionException e )
+ {
+ throw new BuildException( "Unable to resolve artifact: " + e.getMessage(), e );
+ }
+ catch ( ArtifactNotFoundException e )
+ {
+ // no javadocs available: no problem
+ }
+ }
+ }
}
}
@@ -286,6 +326,14 @@
getProject().addReference( sourcesFilesetId, sourcesFileSet );
}
+ if ( javadocsFilesetId != null )
+ {
+ if (!javadocsFileSet.hasPatterns()) {
+ javadocsFileSet.createExclude().setName( "**/**" );
+ }
+ getProject().addReference( javadocsFilesetId, javadocsFileSet );
+ }
+
if ( versionsId != null )
{
String versionsValue = StringUtils.join( versions.iterator(), File.pathSeparator );
@@ -327,7 +375,17 @@
{
return sourcesFilesetId;
}
+
+ public void setJavadocsFilesetId( String filesetId )
+ {
+ this.javadocsFilesetId = filesetId;
+ }
+ public String getJavadocsFilesetId()
+ {
+ return javadocsFilesetId;
+ }
+
public void setFilesetId( String filesetId )
{
this.filesetId = filesetId;
Index: sample.build.xml
===================================================================
--- sample.build.xml (revision 591982)
+++ sample.build.xml (working copy)
@@ -163,6 +163,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+