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/04/03 02:36:38 UTC
svn commit: r390929 - in
/maven/plugins/trunk/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr:
AbstractJxrReport.java JxrReport.java JxrTestReport.java
Author: brett
Date: Sun Apr 2 17:36:36 2006
New Revision: 390929
URL: http://svn.apache.org/viewcvs?rev=390929&view=rev
Log:
Improve Javadoc linking
Modified:
maven/plugins/trunk/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/AbstractJxrReport.java
maven/plugins/trunk/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/JxrReport.java
maven/plugins/trunk/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/JxrTestReport.java
Modified: maven/plugins/trunk/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/AbstractJxrReport.java
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/AbstractJxrReport.java?rev=390929&r1=390928&r2=390929&view=diff
==============================================================================
--- maven/plugins/trunk/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/AbstractJxrReport.java (original)
+++ maven/plugins/trunk/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/AbstractJxrReport.java Sun Apr 2 17:36:36 2006
@@ -79,13 +79,6 @@
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"
@@ -123,12 +116,6 @@
*/
private String stylesheet;
- /*
- * Tells whether Javadoc is part of the reports being generated during the build
- * TODO: not used as for now, should think about that
- */
- private boolean javadocReportGenerated;
-
/**
* The projects in the reactor for aggregation report.
*
@@ -173,7 +160,6 @@
ReportPlugin reportPlugin = (ReportPlugin) iter.next();
if ( "maven-javadoc-plugin".equals( reportPlugin.getArtifactId() ) )
{
- javadocReportGenerated = true;
break;
}
}
@@ -229,11 +215,11 @@
JXR jxr = new JXR();
jxr.setDest( destinationDirectory );
jxr.setInputEncoding( inputEncoding );
- jxr.setJavadocLinkDir( javadocDir );
jxr.setLocale( locale );
jxr.setLog( new PluginLogAdapter( getLog() ) );
jxr.setOutputEncoding( outputEncoding );
jxr.setRevision( "HEAD" );
+ jxr.setJavadocLinkDir( getJavadocLocation() );
jxr.xref( sourceDirs, templateDir, windowTitle, docTitle, bottom );
@@ -388,4 +374,6 @@
protected abstract List getSourceRoots();
protected abstract List getSourceRoots( MavenProject project );
+
+ protected abstract String getJavadocLocation();
}
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=390929&r1=390928&r2=390929&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 Sun Apr 2 17:36:36 2006
@@ -16,8 +16,11 @@
* limitations under the License.
*/
+import org.apache.maven.model.ReportPlugin;
import org.apache.maven.project.MavenProject;
+import java.io.File;
+import java.util.Iterator;
import java.util.List;
import java.util.Locale;
@@ -47,6 +50,21 @@
*/
private String destDir;
+ /**
+ * Folder where Javadoc is generated for this project.
+ *
+ * @parameter expression="${project.build.directory}/site/apidocs"
+ */
+ private File javadocDir;
+
+ /**
+ * Link the Javadoc from the Source XRef. Defaults to true and will link
+ * automatically if javadoc plugin is being used.
+ *
+ * @parameter expression="${linkJavadoc}" default-value="true"
+ */
+ private boolean linkJavadoc;
+
protected String getDestinationDirectory()
{
return destDir;
@@ -92,4 +110,38 @@
return "xref/index";
}
+ protected String getJavadocLocation()
+ {
+ String location = null;
+ if ( linkJavadoc )
+ {
+ // We don't need to do the whole translation thing like normal, because JXR does it internally.
+ // It probably shouldn't.
+ if ( javadocDir.exists() )
+ {
+ // XRef was already generated by manual execution of a lifecycle binding
+ location = javadocDir.getAbsolutePath();
+ }
+ else
+ {
+ // Not yet generated - check if the report is on its way
+ for ( Iterator reports = getProject().getReportPlugins().iterator(); reports.hasNext(); )
+ {
+ ReportPlugin report = (ReportPlugin) reports.next();
+
+ String artifactId = report.getArtifactId();
+ if ( "maven-javadoc-plugin".equals( artifactId ) )
+ {
+ location = javadocDir.getAbsolutePath();
+ }
+ }
+ }
+
+ if ( location == null )
+ {
+ getLog().warn( "Unable to locate Javadoc to link to - DISABLED" );
+ }
+ }
+ return location;
+ }
}
Modified: maven/plugins/trunk/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/JxrTestReport.java
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/JxrTestReport.java?rev=390929&r1=390928&r2=390929&view=diff
==============================================================================
--- maven/plugins/trunk/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/JxrTestReport.java (original)
+++ maven/plugins/trunk/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/JxrTestReport.java Sun Apr 2 17:36:36 2006
@@ -92,4 +92,10 @@
{
return "xref-test/index";
}
+
+ protected String getJavadocLocation()
+ {
+ // Don't link Javadoc
+ return null;
+ }
}