You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by vs...@apache.org on 2006/09/04 16:26:08 UTC
svn commit: r440090 - in /maven/plugins/trunk/maven-javadoc-plugin/src:
main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java
site/fml/faq.fml
Author: vsiveton
Date: Mon Sep 4 07:26:07 2006
New Revision: 440090
URL: http://svn.apache.org/viewvc?view=rev&rev=440090
Log:
MJAVADOC-87: doc-files ignored if they reside in the resources directory
o added a Javadoc resource directory (for package.html, images...)
o updated FAQ
Modified:
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java
maven/plugins/trunk/maven-javadoc-plugin/src/site/fml/faq.fml
Modified: maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java?view=diff&rev=440090&r1=440089&r2=440090
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java (original)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java Mon Sep 4 07:26:07 2006
@@ -106,6 +106,13 @@
protected MavenProject project;
/**
+ * Specifies the Javadoc ressources directory to be included in the Javadoc (i.e. package.html, images...).
+ *
+ * @parameter expression="${basedir}/src/main/javadoc"
+ */
+ private String javadocDirectory;
+
+ /**
* Set an additional parameter(s) on the command line. This value should include quotes as necessary for parameters
* that include spaces.
*
@@ -649,12 +656,12 @@
return;
}
- File javadocDirectory = new File( getOutputDirectory() );
- javadocDirectory.mkdirs();
+ File javadocOutputDirectory = new File( getOutputDirectory() );
+ javadocOutputDirectory.mkdirs();
if ( !files.isEmpty() )
{
- File file = new File( javadocDirectory, "files" );
+ File file = new File( javadocOutputDirectory, "files" );
file.deleteOnExit();
try
{
@@ -669,7 +676,7 @@
try
{
// Copy default style sheet
- copyDefaultStylesheet( javadocDirectory );
+ copyDefaultStylesheet( javadocOutputDirectory );
}
catch ( IOException e )
{
@@ -706,7 +713,7 @@
List arguments = new ArrayList();
- cmd.setWorkingDirectory( javadocDirectory.getAbsolutePath() );
+ cmd.setWorkingDirectory( javadocOutputDirectory.getAbsolutePath() );
cmd.setExecutable( getJavadocPath() );
// General javadoc arguments
@@ -756,7 +763,7 @@
addArgIfNotEmpty( arguments, "-bottom", quotedArgument( getBottomText( project.getInceptionYear() ) ) );
addArgIf( arguments, breakiterator, "-breakiterator", MIN_JAVA_VERSION );
addArgIfNotEmpty( arguments, "-charset", quotedArgument( charset ) );
- addArgIfNotEmpty( arguments, "-d", quotedPathArgument( javadocDirectory.toString() ) );
+ addArgIfNotEmpty( arguments, "-d", quotedPathArgument( javadocOutputDirectory.toString() ) );
addArgIf( arguments, docfilessubdirs, "-docfilessubdirs", MIN_JAVA_VERSION );
addArgIfNotEmpty( arguments, "-docencoding", quotedArgument( docencoding ) );
addArgIfNotEmpty( arguments, "-doctitle", quotedArgument( doctitle ) );
@@ -802,7 +809,7 @@
addArgIf( arguments, notree, "-notree" );
addArgIf( arguments, serialwarn, "-serialwarn" );
addArgIf( arguments, splitindex, "-splitindex" );
- addArgIfNotEmpty( arguments, "-stylesheetfile", quotedPathArgument( getStylesheetFile( javadocDirectory ) ) );
+ addArgIfNotEmpty( arguments, "-stylesheetfile", quotedPathArgument( getStylesheetFile( javadocOutputDirectory ) ) );
addArgIfNotEmpty( arguments, "-taglet", quotedArgument( taglet ), MIN_JAVA_VERSION );
addArgIfNotEmpty( arguments, "-tagletpath", quotedPathArgument( tagletpath ), MIN_JAVA_VERSION );
@@ -833,7 +840,7 @@
if ( options.length() > 0 )
{
- File optionsFile = new File( javadocDirectory, "options" );
+ File optionsFile = new File( javadocOutputDirectory, "options" );
for ( Iterator it = arguments.iterator(); it.hasNext(); )
{
options.append( " " );
@@ -978,6 +985,19 @@
sourcePaths.addAll( project.getExecutionProject().getCompileSourceRoots() );
}
+ if ( javadocDirectory != null )
+ {
+ File javadocDir = new File( javadocDirectory );
+ if ( !javadocDir.exists() || !javadocDir.isDirectory() )
+ {
+ getLog().warn( "The file '" + javadocDirectory + "' doesn't exists or it is not a directory." );
+ }
+ else
+ {
+ sourcePaths.add( javadocDirectory );
+ }
+ }
+
if ( aggregate && project.isExecutionRoot() )
{
for ( Iterator i = reactorProjects.iterator(); i.hasNext(); )
@@ -1214,7 +1234,8 @@
}
else
{
- if ( ( project.getOrganization() != null ) && ( !StringUtils.isEmpty( project.getOrganization().getName() ) ) )
+ if ( ( project.getOrganization() != null )
+ && ( !StringUtils.isEmpty( project.getOrganization().getName() ) ) )
{
if ( !StringUtils.isEmpty( project.getOrganization().getUrl() ) )
{
@@ -1223,7 +1244,8 @@
}
else
{
- theBottom = StringUtils.replace( theBottom, "{organizationName}", project.getOrganization().getName() );
+ theBottom = StringUtils.replace( theBottom, "{organizationName}", project.getOrganization()
+ .getName() );
}
}
else
@@ -1240,17 +1262,17 @@
* either the stylesheet included in the plugin or the stylesheet file used by the javadoc tool
* will be used.
*
- * @param javadocDirectory the base directory of the plugin
+ * @param javadocOutputDirectory the base directory of the plugin
* @return a String that contains the path to the stylesheet file
*/
- private String getStylesheetFile( File javadocDirectory )
+ private String getStylesheetFile( File javadocOutputDirectory )
{
String stylesheetfile = this.stylesheetfile;
if ( StringUtils.isEmpty( stylesheetfile ) )
{
if ( "maven".equals( stylesheet ) )
{
- stylesheetfile = javadocDirectory + File.separator + DEFAULT_CSS_NAME;
+ stylesheetfile = javadocOutputDirectory + File.separator + DEFAULT_CSS_NAME;
}
}
return stylesheetfile;
@@ -1496,7 +1518,7 @@
* @see <a href="http://jakarta.apache.org/commons/lang/api/org/apache/commons/lang/SystemUtils.html#isJavaVersionAtLeast(float)">SystemUtils.html#isJavaVersionAtLeast(float)</a>
*/
private void addArgIfNotEmpty( List arguments, String key, String value, float requiredJavaVersion,
- boolean repeatKey )
+ boolean repeatKey )
{
if ( SystemUtils.isJavaVersionAtLeast( requiredJavaVersion ) )
{
Modified: maven/plugins/trunk/maven-javadoc-plugin/src/site/fml/faq.fml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/site/fml/faq.fml?view=diff&rev=440090&r1=440089&r2=440090
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/site/fml/faq.fml (original)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/site/fml/faq.fml Mon Sep 4 07:26:07 2006
@@ -15,12 +15,42 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
-
+
<faqs id="FAQ" title="Frequently Asked Questions">
<part id="General">
<faq id="Where in the pom.xml do I configure the Javadoc plugin?">
<question>Where in the pom.xml do I configure the Javadoc plugin?</question>
- <answer><p>Like all other site report plugins, the Javadoc plugin goes in the <i>reporting</i> section of your pom.xml.</p></answer>
+ <answer>
+ <p>
+ Like all other site report plugins, the Javadoc plugin goes in the
+ <i>reporting</i> section of your pom.xml.
+ </p>
+ </answer>
+ </faq>
+ <faq id="Where do I put javadoc resources like package.html?">
+ <question>Where do I put Javadoc resources like HTML files or images?</question>
+ <answer>
+ <p>
+ All javadoc resources like HTML files, images could be put in the
+ <i>${basedir}/src/main/javadoc</i> directory.
+ </p>
+ <p>
+ Here is the directory layout expected by Maven Javadoc Plugin:
+ </p>
+ <source>
+yourproject
+ |-- src
+ |-- main
+ |-- java
+ |-- org
+ |...
+ `-- MyClass.java
+ |-- javadoc
+ |-- org
+ |...
+ `-- package.html
+ </source>
+ </answer>
</faq>
</part>
</faqs>