You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by br...@apache.org on 2006/03/23 04:57:22 UTC
svn commit: r388018 -
/maven/plugins/trunk/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/JxrReport.java
Author: brett
Date: Wed Mar 22 19:57:19 2006
New Revision: 388018
URL: http://svn.apache.org/viewcvs?rev=388018&view=rev
Log:
[MJXR-6] Jxr breaks in projects with generated-sources directories
Modified:
maven/plugins/trunk/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/JxrReport.java
Modified: maven/plugins/trunk/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/JxrReport.java
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/JxrReport.java?rev=388018&r1=388017&r2=388018&view=diff
==============================================================================
--- maven/plugins/trunk/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/JxrReport.java (original)
+++ maven/plugins/trunk/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/JxrReport.java Wed Mar 22 19:57:19 2006
@@ -28,6 +28,7 @@
import java.io.File;
import java.io.IOException;
import java.net.URL;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
@@ -60,6 +61,7 @@
/**
* Source directories of the project.
+ *
* @parameter expression="${project.compileSourceRoots}"
* @required
* @readonly
@@ -68,6 +70,7 @@
/**
* Test directories of the project.
+ *
* @parameter expression="${project.testCompileSourceRoots}"
* @required
* @readonly
@@ -76,6 +79,7 @@
/**
* Output folder where the main page of the report will be generated.
+ *
* @parameter expression="${project.build.directory}/site"
* @required
*/
@@ -83,42 +87,49 @@
/**
* Folder where the Xref files will be copied to.
+ *
* @parameter expression="${project.build.directory}/site/xref"
*/
private String destDir;
/**
* File input encoding.
+ *
* @parameter default-value="ISO-8859-1"
*/
private String inputEncoding;
/**
* File output encoding.
+ *
* @parameter default-value="ISO-8859-1"
*/
private String outputEncoding;
/**
* Folder where Javadoc is generated for this project.
+ *
* @parameter expression="${project.build.directory}/site/apidocs"
*/
private String javadocDir;
/**
* Title of window of the Xref HTML files.
+ *
* @parameter expression="${project.name} ${project.version} Reference"
*/
private String windowTitle;
/**
* Title of main page of the Xref HTML files.
+ *
* @parameter expression="${project.name} ${project.version} Reference"
*/
private String docTitle;
/**
* String uses at the bottom of the Xref HTML files.
+ *
* @parameter expression="Copyright © ${project.inceptionYear} ${project.organization.name}. All Rights Reserved."
*/
private String bottom;
@@ -135,6 +146,7 @@
/**
* Style sheet used for the Xref HTML files.
* Should not be used. If used, should be an absolute path, like "${basedir}/myStyles.css".
+ *
* @parameter default-value="stylesheet.css"
*/
private String stylesheet;
@@ -181,7 +193,10 @@
sink.text( getBundle( locale ).getString( "report.xref.projectSources.title" ) );
sink.sectionTitle2_();
sink.paragraph();
- if ( hasSources( sourceDirs ) )
+
+ List sourceDirs = pruneSourceDirs( this.sourceDirs );
+
+ if ( !sourceDirs.isEmpty() )
{
try
{
@@ -210,6 +225,20 @@
sink.section2_();
}
+ private List pruneSourceDirs( List sourceDirs )
+ {
+ List pruned = new ArrayList( sourceDirs.size() );
+ for ( Iterator i = sourceDirs.iterator(); i.hasNext(); )
+ {
+ String dir = (String) i.next();
+ if ( hasSources( new File( dir ) ) )
+ {
+ pruned.add( dir );
+ }
+ }
+ return pruned;
+ }
+
private boolean hasSources( List sourceDirs )
{
boolean found = false;
@@ -235,7 +264,9 @@
sink.text( getBundle( locale ).getString( "report.xref.testSources.title" ) );
sink.sectionTitle2_();
sink.paragraph();
- if ( hasSources( testSourceDirs ) )
+
+ List testSourceDirs = pruneSourceDirs( this.testSourceDirs );
+ if ( !testSourceDirs.isEmpty() )
{
try
{
@@ -363,9 +394,9 @@
* Creates the Xref for the Java files found in the given source directory and puts
* them in the given destination directory.
*
- * @param locale The user locale to use for the Xref generation
+ * @param locale The user locale to use for the Xref generation
* @param destinationDirectory The output folder
- * @param sourceDirs The source directories
+ * @param sourceDirs The source directories
* @throws IOException
* @throws Exception
*/
@@ -481,7 +512,7 @@
* Returns the correct resource bundle according to the locale
*
* @param locale :
- * the locale of the user
+ * the locale of the user
* @return the bundle correponding to the locale
*/
private ResourceBundle getBundle( Locale locale )