From 2c9c349142a22111dedc57896c0dadc5ac846ff9 Mon Sep 17 00:00:00 2001 From: kaz Date: Fri, 31 Jan 2003 18:25:28 +0000 Subject: [PATCH] Here is a first pass to enable users to specify what reports should appear in their published site's "Project Reports" section of the navbar. Users can now specify a section in the POM that specifies exactly which reports should be included in one's site. For example: maven-changelog-plugin maven-junit-report-plugin maven-javadoc-plugin maven-jxr-plugin This would only run the above four plugins when 'maven site' is invoked. In addition, the navbar and the maven-reports document that is generated will only contain links to the above specified reports. Please note, that the order the reports are specified is the order in which they will appear. Note: if you do not have a section in the POM, you will fallback to the standard behavior (which is predefined reports). Lets talk about how this all works now. Previously, site.jsl in the xdoc plugin contained a static set of reports that were included in the navbar. This could not be changed by end users. In addition, we also had a separate xdoc to maintain which contained a description of all of the reports (this page is displayed when you click on 'Project Reports' to expand that section of the navbar). Again, this was a static page. Finally, a developer writing their own plugin which generated a report, would have to submit patches for both of these files for their report to be included when a 'maven site' was executed. All of the above deficiencies have been corrected when using the new mechansim. There is a new protocol which plugin developers should follow if their plugin generates a report. Their plugin's plugin.jelly file should contain a gool like this (don't forget to include the 'xmlns:doc="doc"' declaration as well): The above should be pretty self explanatory. The plugin developer simply defines a 'name'. The 'name' is used in the navbar and in the first column of the table in the auto-generated maven-reports file. 'link' is the relative link from the doc directory to the generated report (without the extension). Finally, a 'description' should be used to create a one line summary of the report's contents. This is used when auto-generating the maven-reports document. A plugin may define multiple reports if needed. For example, here is the javadoc plugin example: Another important difference you'll notice above is that the conditional tests of whether or not a report should appear is no longer part of site.jsl. The logic of determining whether the report appears now lies within the plugin that generates the report. Thus, in the above example, only if sources are present, will the reports actually appear in the navbar and maven-reports document. So what happens when one types 'maven site'? Basically, for each defined, maven will try to on that report. The goal runs as it normally does. The magic kicks in when the 'xdoc' plugin is run (after all of the have been run). The first thing the xdoc plugin does is determine what reports should be included in all of the documentation it generates. The report list (its really a set) is generated when xdoc calls its own 'xdoc:register-reports' goal. This goal looks at each defined in the POM and then calls where "xyz" corresponds to the name defined in the . This is where the new protocol is required. If that goal does not exist, you will get an error from Jelly. As each of the xyz:register goals are called, they invoke the tag (which is defined in the xdoc plugin), this tag basically builds a set of hashtables. Each hashtable corresponds to a report and contains a 'name', 'link', and 'description' entry. After the completion of 'xdoc:register-reports' we now have a set in the xdoc context called 'reports' which contains our descriptions of each report. Site.jsl uses this to dynamically build up the navbar, and the maven-reports document uses it to build the content of itself. Phew! That was a long one. In summary, if you don't use nothing changes (at least it shouldn't), but in the future, if this thing works out, we will migrate users in this direction. git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@112789 13f79535-47bb-0310-9956-ffa450edef68 --- changelog/plugin.jelly | 7 + checkstyle/plugin.jelly | 7 + developer-activity/plugin.jelly | 7 + file-activity/plugin.jelly | 7 + javadoc/plugin.jelly | 16 +- jdepend/plugin.jelly | 7 + junit-report/plugin.jelly | 7 + jxr/plugin.jelly | 10 + site/plugin.jelly | 31 ++- tasklist/plugin.jelly | 8 + xdoc/plugin.jelly | 41 +++- xdoc/src/plugin-resources/site.jsl | 224 +++++++++++------- .../templates/maven-reports.xml | 197 +++++++-------- 13 files changed, 371 insertions(+), 198 deletions(-) diff --git a/changelog/plugin.jelly b/changelog/plugin.jelly index aee59af0..78a445ca 100644 --- a/changelog/plugin.jelly +++ b/changelog/plugin.jelly @@ -6,6 +6,13 @@ xmlns:changelog="changelog" xmlns:doc="doc"> + + + + + + + + diff --git a/developer-activity/plugin.jelly b/developer-activity/plugin.jelly index b6d3a370..86c3dec9 100644 --- a/developer-activity/plugin.jelly +++ b/developer-activity/plugin.jelly @@ -6,6 +6,13 @@ xmlns:changelog="changelog" xmlns:doc="doc"> + + + + diff --git a/file-activity/plugin.jelly b/file-activity/plugin.jelly index e3d93171..a03b96ad 100644 --- a/file-activity/plugin.jelly +++ b/file-activity/plugin.jelly @@ -6,6 +6,13 @@ xmlns:changelog="changelog" xmlns:doc="doc"> + + + + diff --git a/javadoc/plugin.jelly b/javadoc/plugin.jelly index a4e03a94..adabcb49 100644 --- a/javadoc/plugin.jelly +++ b/javadoc/plugin.jelly @@ -3,12 +3,26 @@ + + + + + + + - + diff --git a/jdepend/plugin.jelly b/jdepend/plugin.jelly index cafe636a..7dbd07ef 100644 --- a/jdepend/plugin.jelly +++ b/jdepend/plugin.jelly @@ -2,6 +2,13 @@ + + + + diff --git a/junit-report/plugin.jelly b/junit-report/plugin.jelly index 893c476c..51f8b410 100644 --- a/junit-report/plugin.jelly +++ b/junit-report/plugin.jelly @@ -4,6 +4,13 @@ xmlns:j="jelly:core" xmlns:doc="doc"> + + + + diff --git a/jxr/plugin.jelly b/jxr/plugin.jelly index 46ba1947..257b2d67 100644 --- a/jxr/plugin.jelly +++ b/jxr/plugin.jelly @@ -3,8 +3,18 @@ + + + + + + - - - - - - - - - - + + + + + Generating the ${report} ... + + + + + + + + + + + + + + + + diff --git a/tasklist/plugin.jelly b/tasklist/plugin.jelly index 81480d2b..fa5b0a32 100644 --- a/tasklist/plugin.jelly +++ b/tasklist/plugin.jelly @@ -2,8 +2,16 @@ + + + + diff --git a/xdoc/plugin.jelly b/xdoc/plugin.jelly index 2858bb0d..18e5c9e7 100644 --- a/xdoc/plugin.jelly +++ b/xdoc/plugin.jelly @@ -13,6 +13,20 @@ + + + + + + + + + + + + @@ -205,7 +222,7 @@ Generating xdocs from POM ... @@ -214,6 +231,9 @@ + @@ -409,8 +429,25 @@ + + + + + + + + + ${report} is registering with the xdoc plugin ... + + + + diff --git a/xdoc/src/plugin-resources/site.jsl b/xdoc/src/plugin-resources/site.jsl index 77451a03..244fb492 100644 --- a/xdoc/src/plugin-resources/site.jsl +++ b/xdoc/src/plugin-resources/site.jsl @@ -193,99 +193,141 @@ Project Reports - ${maven.xdoc.projectReports} - - - -
- - Tasks - -
-
- -
- - Task List - -
-
- -
- - Changes - -
-
- -
- - Change Log - -
- -
- - File Activity - -
+ + + + + + + + + + + + + + + - -
- - Unit Tests - -
-
- -
- - Metric Results - -
- -
- - Javadoc Report - -
-
- - - - -
- - Cactus Tests - -
-
-
-
+ + + + ${maven.xdoc.projectReports} + + + +
+ + Tasks + +
+
+ +
+ + Task List + +
+
+ +
+ + Changes + +
+
+ +
+ + Change Log + +
+ +
+ + File Activity + +
+
+ +
+ + Unit Tests + +
+
+ +
+ + Metric Results + +
+ +
+ + Javadoc Report + +
+
+ + + + +
+ + Cactus Tests + +
+
+
+
+
+ - -
- - JavaDocs - -
- + + +
+ + JavaDocs + +
+ +
diff --git a/xdoc/src/plugin-resources/templates/maven-reports.xml b/xdoc/src/plugin-resources/templates/maven-reports.xml index 94cc6c39..c6bb3e1d 100644 --- a/xdoc/src/plugin-resources/templates/maven-reports.xml +++ b/xdoc/src/plugin-resources/templates/maven-reports.xml @@ -18,100 +18,109 @@ - - - - #if ($project.repository) - - - - - - - - - - #end - - - - - - - #if ($files.file($project.build.unitTestSourceDirectory).exists()) - - - - #end - - #if ($files.file($project.build.sourceDirectory).exists()) - - - - - - - - - - #end - - #if ($files.file("$maven-docs-dest/clover").exists()) - - - - #end - #if ($files.file("$gen-xdocs/cactus-report.xml").exists()) - - - + #if (! $project.reports.isEmpty()) + #foreach ($report in $reports) + + + + + #end + #else + + + + #if ($project.repository) + + + + + + + + + + #end + + + + + + + #if ($files.file($project.build.unitTestSourceDirectory).exists()) + + + + #end + + #if ($files.file($project.build.sourceDirectory).exists()) + + + + + + + + + + #end + + #if ($files.file("$maven-docs-dest/clover").exists()) + + + + #end + #if ($files.file("$gen-xdocs/cactus-report.xml").exists()) + + + + #end #end
DocumentDescription
Changes - This document provides a history of the changes made to the - project, in a user friendly format, generated from the - xdocs/changes.xml file. -
Change Log - This document provides a history of the most recent - changes made to the project taken directly from the - source code repository. -
Developer Activity - This document provides a report of activity in terms of - CVS commits and breaks it out by developer. -
File Activity - This document provides a report of activity in terms of - CVS commits and breaks it out by file. -
Tasks - This document provides a list of tasks that need to - be completed for the project, generated from the - xdocs/tasks.xml file. -
Task List - This document provides a list of tasks that need to - be completed for the project, generated from the - @task javadoc tag in java source code. -
Unit Tests - This document provides the results of the unit tests that - are part of this project. Successes and failures are - noted. -
Metric Results - This document provides information on various source code - metrics that have been computed. These metrics can - provide useful information regarding the abstractness and - total number of classes. -
Checkstyle Report - This document provides the results of the Checkstyle - report. This report provides an indication of how well - this project complies with its coding conventions. -
Javadoc Report - This document the details of javadoc execution against - the project. This encourages the reduction of javadoc - errors. -
Clover Test Coverage - This document provides the results of the Clover report. This - reports show what portion on your code has been executed by - your test suite and generates statistics. It gives a very good - idea of how good your test suite is. -
Cactus Tests - This document provides the results of the Cactus unit tests that - are part of this project. Successes and failures are noted. -
$report.name$report.description
Changes + This document provides a history of the changes made to the + project, in a user friendly format, generated from the + xdocs/changes.xml file. +
Change Log + This document provides a history of the most recent + changes made to the project taken directly from the + source code repository. +
Developer Activity + This document provides a report of activity in terms of + CVS commits and breaks it out by developer. +
File Activity + This document provides a report of activity in terms of + CVS commits and breaks it out by file. +
Tasks + This document provides a list of tasks that need to + be completed for the project, generated from the + xdocs/tasks.xml file. +
Task List + This document provides a list of tasks that need to + be completed for the project, generated from the + @task javadoc tag in java source code. +
Unit Tests + This document provides the results of the unit tests that + are part of this project. Successes and failures are + noted. +
Metric Results + This document provides information on various source code + metrics that have been computed. These metrics can + provide useful information regarding the abstractness and + total number of classes. +
Checkstyle Report + This document provides the results of the Checkstyle + report. This report provides an indication of how well + this project complies with its coding conventions. +
Javadoc Report + This document the details of javadoc execution against + the project. This encourages the reduction of javadoc + errors. +
Clover Test Coverage + This document provides the results of the Clover report. This + reports show what portion on your code has been executed by + your test suite and generates statistics. It gives a very good + idea of how good your test suite is. +
Cactus Tests + This document provides the results of the Cactus unit tests that + are part of this project. Successes and failures are noted. +