Property changes on: . ___________________________________________________________________ Name: svn:ignore - target *~ *.log .classpath .project *.ipr *.iws *.iml .wtpmodules + target *~ *.log .classpath .project *.ipr *.iws *.iml .wtpmodules nbproject Index: src/main/java/org/apache/maven/artifact/ant/DependenciesTask.java =================================================================== --- src/main/java/org/apache/maven/artifact/ant/DependenciesTask.java (revision 578034) +++ src/main/java/org/apache/maven/artifact/ant/DependenciesTask.java (working copy) @@ -73,6 +73,8 @@ private String sourcesFilesetId; + private String javadocsFilesetId; + private String versionsId; private String useScope; @@ -214,6 +216,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() ) @@ -268,6 +276,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 + } + } + } } } @@ -288,6 +328,11 @@ getProject().addReference( sourcesFilesetId, sourcesFileSet ); } + if ( javadocsFilesetId != null ) + { + getProject().addReference( javadocsFilesetId, javadocsFileSet ); + } + if ( versionsId != null ) { String versionsValue = StringUtils.join( versions.iterator(), File.pathSeparator ); @@ -329,7 +374,17 @@ { return sourcesFilesetId; } + + public void setJavadocsFilesetId( String filesetId ) + { + this.javadocsFilesetId = filesetId; + } + public String getJavadocsFilesetId() + { + return javadocsFilesetId; + } + public void setFilesetId( String filesetId ) { this.filesetId = filesetId;