You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ep...@apache.org on 2006/07/05 05:53:01 UTC
svn commit: r419154 - in
/maven/sandbox/plugins/maven-docck-plugin/src/main/java/org/apache/maven/plugin/docck:
AbstractCheckDocumentationMojo.java CheckPluginDocumentationMojo.java
Author: epunzalan
Date: Tue Jul 4 20:53:01 2006
New Revision: 419154
URL: http://svn.apache.org/viewvc?rev=419154&view=rev
Log:
- fixed bug on siteDirectory usage in ${reactorProjects}.
- created a cache on valid urls to speed up execution
Modified:
maven/sandbox/plugins/maven-docck-plugin/src/main/java/org/apache/maven/plugin/docck/AbstractCheckDocumentationMojo.java
maven/sandbox/plugins/maven-docck-plugin/src/main/java/org/apache/maven/plugin/docck/CheckPluginDocumentationMojo.java
Modified: maven/sandbox/plugins/maven-docck-plugin/src/main/java/org/apache/maven/plugin/docck/AbstractCheckDocumentationMojo.java
URL: http://svn.apache.org/viewvc/maven/sandbox/plugins/maven-docck-plugin/src/main/java/org/apache/maven/plugin/docck/AbstractCheckDocumentationMojo.java?rev=419154&r1=419153&r2=419154&view=diff
==============================================================================
--- maven/sandbox/plugins/maven-docck-plugin/src/main/java/org/apache/maven/plugin/docck/AbstractCheckDocumentationMojo.java (original)
+++ maven/sandbox/plugins/maven-docck-plugin/src/main/java/org/apache/maven/plugin/docck/AbstractCheckDocumentationMojo.java Tue Jul 4 20:53:01 2006
@@ -27,8 +27,8 @@
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.plugin.docck.reports.DocumentationReporter;
import org.apache.maven.plugin.docck.reports.DocumentationReport;
+import org.apache.maven.plugin.docck.reports.DocumentationReporter;
import org.apache.maven.project.MavenProject;
import org.apache.maven.shared.model.fileset.FileSet;
import org.apache.maven.shared.model.fileset.util.FileSetManager;
@@ -40,6 +40,7 @@
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
+import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
@@ -74,7 +75,7 @@
* @parameter expression="${siteDirectory}" default-value="src/site"
* @todo should be determined programmatically
*/
- protected File siteDirectory;
+ protected String siteDirectory;
/**
* Sets whether this plugin is running in offline or online mode. Also useful when you don't want
@@ -88,6 +89,8 @@
private FileSetManager fileSetManager = new FileSetManager();
+ private List validUrls = new ArrayList();
+
protected AbstractCheckDocumentationMojo()
{
httpClient = new HttpClient();
@@ -201,7 +204,7 @@
if ( buffer.length() > 0 )
{
- messages = "\nThe following documentation problems were found:\n" + buffer.toString();
+ messages = "\nThe following documentation problems were found:\n" + buffer.toString();
}
return messages;
@@ -398,7 +401,11 @@
if ( protocol.startsWith( "http" ) )
{
- if ( !offline )
+ if ( offline )
+ {
+ reporter.warn( "Cannot verify " + description + " in offline mode with URL: \'" + url + "\'." );
+ }
+ else if ( !validUrls.contains( url ) )
{
HeadMethod headMethod = new HeadMethod( url );
headMethod.setFollowRedirects( true );
@@ -411,6 +418,10 @@
{
reporter.error( "Cannot reach " + description + " with URL: \'" + url + "\'." );
}
+ else
+ {
+ validUrls.add( url );
+ }
}
catch ( HttpException e )
{
@@ -426,10 +437,6 @@
{
headMethod.releaseConnection();
}
- }
- else
- {
- reporter.warn( "Cannot verify " + description + " in offline mode with URL: \'" + url + "\'." );
}
}
else
Modified: maven/sandbox/plugins/maven-docck-plugin/src/main/java/org/apache/maven/plugin/docck/CheckPluginDocumentationMojo.java
URL: http://svn.apache.org/viewvc/maven/sandbox/plugins/maven-docck-plugin/src/main/java/org/apache/maven/plugin/docck/CheckPluginDocumentationMojo.java?rev=419154&r1=419153&r2=419154&view=diff
==============================================================================
--- maven/sandbox/plugins/maven-docck-plugin/src/main/java/org/apache/maven/plugin/docck/CheckPluginDocumentationMojo.java (original)
+++ maven/sandbox/plugins/maven-docck-plugin/src/main/java/org/apache/maven/plugin/docck/CheckPluginDocumentationMojo.java Tue Jul 4 20:53:01 2006
@@ -129,8 +129,10 @@
private void checkProjectSite( MavenProject project, DocumentationReporter reporter )
{
+ File projectSiteDirectory = new File( project.getBasedir(), siteDirectory );
+
// check for site.xml
- File siteXml = new File( siteDirectory, "site.xml" );
+ File siteXml = new File( projectSiteDirectory, "site.xml" );
if ( !siteXml.exists() )
{
@@ -168,18 +170,19 @@
*/
// check for usage.(xml|apt|html)
- if ( !findFiles( siteDirectory, "usage" ) )
+ if ( !findFiles( projectSiteDirectory, "usage" ) )
{
reporter.error( "Missing base usage.(html|xml|apt)." );
}
// check for **/examples/**.(xml|apt|html)
- if ( !findFiles( siteDirectory, "**/examples/*" ) && !findFiles( siteDirectory, "**/example*" ) )
+ if ( !findFiles( projectSiteDirectory, "**/examples/*" ) &&
+ !findFiles( projectSiteDirectory, "**/example*" ) )
{
reporter.error( "Missing examples." );
}
- if ( !findFiles( siteDirectory, "faq" ) )
+ if ( !findFiles( projectSiteDirectory, "faq" ) )
{
reporter.error( "Missing base FAQ.(fml|html|xml|apt)." );
}