MAVEN-214: LinkChecker plugin
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@112777 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
3
linkcheck/.cvsignore
Normal file
3
linkcheck/.cvsignore
Normal file
@@ -0,0 +1,3 @@
|
||||
target
|
||||
velocity.log
|
||||
maven.log
|
||||
18
linkcheck/maven.xml
Normal file
18
linkcheck/maven.xml
Normal file
@@ -0,0 +1,18 @@
|
||||
<project default="java:jar"
|
||||
xmlns:j="jelly:core"
|
||||
xmlns:u="jelly:util"
|
||||
xmlns:ant="jelly:ant"
|
||||
xmlns:m="maven">
|
||||
|
||||
|
||||
<postGoal name="java:compile">
|
||||
<copy toDir="target/classes">
|
||||
<fileset dir="src/main">
|
||||
<includes name="**/*"/>
|
||||
<excludes name="**/*.java"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
</postGoal>
|
||||
|
||||
|
||||
</project>
|
||||
82
linkcheck/plugin.jelly
Normal file
82
linkcheck/plugin.jelly
Normal file
@@ -0,0 +1,82 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<project
|
||||
xmlns:j="jelly:core"
|
||||
xmlns:define="jelly:define"
|
||||
xmlns:linkcheck="linkcheck"
|
||||
xmlns:doc="doc">
|
||||
|
||||
<property name="maven.linkcheck.cache" value="${pom.getPluginContext('maven-linkcheck-plugin').getVariable('maven.linkcheck.cache')}"/>
|
||||
<j:if test="${context.getVariable('maven.linkcheck.enable') != null}">
|
||||
<j:set var="maven.linkcheck.enable" value="true"/>
|
||||
</j:if>
|
||||
|
||||
<define:taglib uri="linkcheck">
|
||||
<define:jellybean
|
||||
name="linkcheck"
|
||||
className="org.apache.maven.linkcheck.LinkCheck"
|
||||
method="doExecute"
|
||||
/>
|
||||
</define:taglib>
|
||||
|
||||
<!-- ================================================================== -->
|
||||
<!-- C R E A T E L I N K C H E C K X M L R E P O R T -->
|
||||
<!-- ================================================================== -->
|
||||
|
||||
<!-- The reason for the odd goal configuration is this:
|
||||
We really don't want the link checker to run until everything else is complete
|
||||
-->
|
||||
|
||||
<goal name="maven-linkcheck-plugin:report">
|
||||
<echo>This run of linkcheck does nothing except create a template linkcheck file</echo>
|
||||
<copy fromFile="${plugin.resources}/linkcheck-temp.xml" toFile="${maven.build.dir}/linkcheck.xml"/>
|
||||
</goal>
|
||||
|
||||
<postGoal name="xdoc:jelly-transform">
|
||||
<attainGoal name="maven-linkcheck-plugin:report-real"/>
|
||||
</postGoal>
|
||||
|
||||
<goal
|
||||
name="maven-linkcheck-plugin:report-real"
|
||||
description="Generate a report from the link check results">
|
||||
<echo>BaseDir: ${basedir}</echo>
|
||||
<mkdir dir="${maven.build.dir}/linkcheck"/>
|
||||
<mkdir dir="${maven.build.dir}/linkcheck/docs"/>
|
||||
<j:choose>
|
||||
<j:when test="${maven.linkcheck.enable}">
|
||||
<echo>Generating the LinkCheck report</echo>
|
||||
<linkcheck:linkcheck
|
||||
cache="${maven.linkcheck.cache}"
|
||||
exclude="${pom.repository.url}"
|
||||
basedir="${maven.docs.dest}"
|
||||
output="${maven.build.dir}/linkcheck/linkcheck-results.xml"
|
||||
outputEncoding="${maven.docs.outputencoding}"
|
||||
/>
|
||||
|
||||
<doc:jsl
|
||||
input="${maven.build.dir}/linkcheck/linkcheck-results.xml"
|
||||
output="../linkcheck/docs/linkcheck.xml"
|
||||
stylesheet="${plugin.resources}/linkcheck.jsl"
|
||||
omitXmlDeclaration="true"
|
||||
outputMode="xml"
|
||||
prettyPrint="true"
|
||||
/>
|
||||
|
||||
<j:set var="maven.xdoc.src" value="${maven.build.dir}/linkcheck/docs"/>
|
||||
<echo>maven.xdoc.src: ${maven.xdoc.src}</echo>
|
||||
<attainGoal name="xdoc:performJSL"/>
|
||||
</j:when>
|
||||
<j:otherwise>
|
||||
<echo>LinkCheck not enabled as maven.linkcheck.enable is not defined.</echo>
|
||||
</j:otherwise>
|
||||
</j:choose>
|
||||
|
||||
</goal>
|
||||
|
||||
<goal name="maven-linkcheck-plugin:clearcache"
|
||||
description="Removes the cache file">
|
||||
<delete file="${maven.linkcheck.cache}"/>
|
||||
</goal>
|
||||
|
||||
|
||||
</project>
|
||||
16
linkcheck/plugin.properties
Normal file
16
linkcheck/plugin.properties
Normal file
@@ -0,0 +1,16 @@
|
||||
# -------------------------------------------------------------------
|
||||
# P L U G I N P R O P E R I E S
|
||||
# -------------------------------------------------------------------
|
||||
# LinkCheck report plugin.
|
||||
# -------------------------------------------------------------------
|
||||
|
||||
maven.build.dir = ${basedir}/target
|
||||
|
||||
|
||||
maven.linkcheck.cache=${maven.build.dir}/linkcheck/linkcheck.cache
|
||||
|
||||
|
||||
|
||||
|
||||
maven.docs.dest = ${maven.build.dir}/docs
|
||||
maven.docs.outputencoding = ISO-8859-1
|
||||
5
linkcheck/project.properties
Normal file
5
linkcheck/project.properties
Normal file
@@ -0,0 +1,5 @@
|
||||
# -------------------------------------------------------------------
|
||||
# P R O J E C T P R O P E R T I E S
|
||||
# -------------------------------------------------------------------
|
||||
maven.xdoc.date=left
|
||||
maven.xdoc.version=${pom.currentVersion}
|
||||
106
linkcheck/project.xml
Normal file
106
linkcheck/project.xml
Normal file
@@ -0,0 +1,106 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<project>
|
||||
|
||||
<extend>${basedir}/../project.xml</extend>
|
||||
<pomVersion>3</pomVersion>
|
||||
<id>maven-linkcheck-plugin</id>
|
||||
<name>Maven LinkCheck Plug-in</name>
|
||||
<currentVersion>1.0</currentVersion>
|
||||
|
||||
<description>
|
||||
</description>
|
||||
|
||||
<shortDescription>Java Project Management Tools</shortDescription>
|
||||
|
||||
<url>http://jakarta.apache.org/turbine/maven/reference/plugins/linkcheck/</url>
|
||||
<issueTrackingUrl>http://jira.werken.com/BrowseProject.jspa?id=10030</issueTrackingUrl>
|
||||
<siteAddress>jakarta.apache.org</siteAddress>
|
||||
<siteDirectory>/www/jakarta.apache.org/turbine/maven/reference/plugins/linkcheck/</siteDirectory>
|
||||
<distributionDirectory>/www/jakarta.apache.org/builds/jakarta-turbine-maven/</distributionDirectory>
|
||||
|
||||
<developers>
|
||||
</developers>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<id>commons-betwixt</id>
|
||||
<version>1.0-beta-1</version>
|
||||
<properties>
|
||||
<classloader>root.maven</classloader>
|
||||
</properties>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<id>commons-collections</id>
|
||||
<version>2.1</version>
|
||||
<properties>
|
||||
<classloader>root.maven</classloader>
|
||||
</properties>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<id>commons-digester</id>
|
||||
<version>1.3</version>
|
||||
<properties>
|
||||
<classloader>root.maven</classloader>
|
||||
</properties>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<id>commons-jelly+tags-jsl</id>
|
||||
<version>SNAPSHOT</version>
|
||||
<properties>
|
||||
<classloader>root.maven</classloader>
|
||||
</properties>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-jelly</groupId>
|
||||
<artifactId>commons-jelly-tags-xml</artifactId>
|
||||
<version>SNAPSHOT</version>
|
||||
<url>http://jakarta.apache.org/commons/sandbox/jelly/tags/xml/</url>
|
||||
<properties>
|
||||
<classloader>root.maven</classloader>
|
||||
</properties>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<id>commons-logging</id>
|
||||
<version>1.0</version>
|
||||
<properties>
|
||||
<classloader>root.maven</classloader>
|
||||
</properties>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<id>httpunit</id>
|
||||
<version>1.5.1</version>
|
||||
<properties>
|
||||
<classloader>root.maven</classloader>
|
||||
</properties>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<id>jtidy</id>
|
||||
<version>4aug2000r7-dev</version>
|
||||
<properties>
|
||||
<classloader>root.maven</classloader>
|
||||
</properties>
|
||||
</dependency>
|
||||
|
||||
<!--dependency>
|
||||
<id>rhino</id>
|
||||
<version>1.5R4-RC3</version>
|
||||
<jar>js-1.5R4-RC3.jar</jar>
|
||||
<properties>
|
||||
<classloader>root.maven</classloader>
|
||||
</properties>
|
||||
</dependency-->
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
||||
|
||||
</project>
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<info>
|
||||
<element name="file">
|
||||
<attribute name="name" property="name"/>
|
||||
<attribute name="successful" property="successful"/>
|
||||
<attribute name="unsuccessful" property="unsuccessful"/>
|
||||
<element name="result" property="results"/>
|
||||
</element>
|
||||
</info>
|
||||
225
linkcheck/src/main/org/apache/maven/linkcheck/FileToCheck.java
Normal file
225
linkcheck/src/main/org/apache/maven/linkcheck/FileToCheck.java
Normal file
@@ -0,0 +1,225 @@
|
||||
package org.apache.maven.linkcheck;
|
||||
|
||||
/* ====================================================================
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 2002 The Apache Software Foundation. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. The end-user documentation included with the redistribution,
|
||||
* if any, must include the following acknowledgment:
|
||||
* "This product includes software developed by the
|
||||
* Apache Software Foundation (http://www.apache.org/)."
|
||||
* Alternately, this acknowledgment may appear in the software itself,
|
||||
* if and wherever such third-party acknowledgments normally appear.
|
||||
*
|
||||
* 4. The names "Apache" and "Apache Software Foundation" and
|
||||
* "Apache Maven" must not be used to endorse or promote products
|
||||
* derived from this software without prior written permission. For
|
||||
* written permission, please contact apache@apache.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "Apache",
|
||||
* "Apache Maven", nor may "Apache" appear in their name, without
|
||||
* prior written permission of the Apache Software Foundation.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Software Foundation. For more
|
||||
* information on the Apache Software Foundation, please see
|
||||
* <http://www.apache.org/>.
|
||||
*
|
||||
* ====================================================================
|
||||
*/
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.maven.linkcheck.validation.LinkValidationItem;
|
||||
import org.apache.maven.linkcheck.validation.LinkValidationResult;
|
||||
import org.apache.maven.linkcheck.validation.LinkValidatorManager;
|
||||
|
||||
import com.meterware.httpunit.GetMethodWebRequest;
|
||||
import com.meterware.httpunit.WebConversation;
|
||||
import com.meterware.httpunit.WebLink;
|
||||
import com.meterware.httpunit.WebRequest;
|
||||
import com.meterware.httpunit.WebResponse;
|
||||
|
||||
/**
|
||||
* @author Ben Walding
|
||||
*
|
||||
*/
|
||||
public class FileToCheck {
|
||||
private File base;
|
||||
private File f;
|
||||
private String status = STATUS_OK;
|
||||
private String message = "";
|
||||
private LinkCheck linkcheck;
|
||||
private int successful;
|
||||
private int unsuccessful;
|
||||
|
||||
public static final String STATUS_UNKNOWN = null;
|
||||
public static final String STATUS_JTIDY_FAILURE = "Unable to tidy source";
|
||||
public static final String STATUS_OK = "OK";
|
||||
|
||||
public FileToCheck(File base, File f) {
|
||||
this.base = base;
|
||||
this.f = f;
|
||||
}
|
||||
|
||||
private List links = new ArrayList();
|
||||
|
||||
public void check(LinkValidatorManager lvm) throws Exception {
|
||||
successful = 0;
|
||||
unsuccessful = 0;
|
||||
status = STATUS_OK;
|
||||
message = "";
|
||||
|
||||
try {
|
||||
WebConversation wc = new WebConversation();
|
||||
WebRequest req = new GetMethodWebRequest(f.toURL().toString());
|
||||
WebResponse resp = wc.getResponse(req);
|
||||
WebLink[] wl = resp.getLinks();
|
||||
Map uniqueLinks = new HashMap();
|
||||
for (int i = 0;
|
||||
i < wl.length;
|
||||
i++) { //It puts the current URL in item 0
|
||||
WebLink link = wl[i];
|
||||
String href =
|
||||
link
|
||||
.getDOMSubtree()
|
||||
.getAttributes()
|
||||
.getNamedItem("href")
|
||||
.getNodeValue();
|
||||
|
||||
uniqueLinks.put(href, href);
|
||||
}
|
||||
|
||||
Iterator iter = uniqueLinks.keySet().iterator();
|
||||
while (iter.hasNext()) {
|
||||
String href = (String) iter.next();
|
||||
|
||||
//System.out.println("Link Found: " + href);
|
||||
|
||||
LinkCheckResult lcr = new LinkCheckResult();
|
||||
|
||||
LinkValidationItem lvi = new LinkValidationItem(f, href);
|
||||
LinkValidationResult result = lvm.validateLink(lvi);
|
||||
lcr.setTarget(href);
|
||||
|
||||
switch (result.getStatus()) {
|
||||
case LinkValidationResult.UNKNOWN :
|
||||
unsuccessful++;
|
||||
lcr.setStatus("UNKNOWN REF");
|
||||
break;
|
||||
case LinkValidationResult.VALID :
|
||||
successful++;
|
||||
lcr.setStatus("OK");
|
||||
break;
|
||||
case LinkValidationResult.INVALID :
|
||||
unsuccessful++;
|
||||
lcr.setStatus("NOT FOUND");
|
||||
break;
|
||||
}
|
||||
|
||||
//FIXME: needs expanding and caching for remote links
|
||||
|
||||
links.add(lcr);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
message = e.toString();
|
||||
System.err.println(e.toString());
|
||||
throw (e);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the message.
|
||||
* @return String
|
||||
*/
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the status.
|
||||
* @return int
|
||||
*/
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the message.
|
||||
* @param message The message to set
|
||||
*/
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the status.
|
||||
* @param status The status to set
|
||||
*/
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public List getResults() {
|
||||
return links;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the successful.
|
||||
* @return int
|
||||
*/
|
||||
public int getSuccessful() {
|
||||
return successful;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the unsuccessful.
|
||||
* @return int
|
||||
*/
|
||||
public int getUnsuccessful() {
|
||||
return unsuccessful;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
String baseName = base.getAbsolutePath();
|
||||
String fileName = f.getAbsolutePath();
|
||||
if (fileName.startsWith(baseName))
|
||||
fileName = fileName.substring(baseName.length() + 1);
|
||||
return fileName;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<info>
|
||||
<element name="linkcheck">
|
||||
<element name="file" property="files"/>
|
||||
</element>
|
||||
</info>
|
||||
288
linkcheck/src/main/org/apache/maven/linkcheck/LinkCheck.java
Normal file
288
linkcheck/src/main/org/apache/maven/linkcheck/LinkCheck.java
Normal file
@@ -0,0 +1,288 @@
|
||||
package org.apache.maven.linkcheck;
|
||||
|
||||
/* ====================================================================
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 2002 The Apache Software Foundation. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. The end-user documentation included with the redistribution,
|
||||
* if any, must include the following acknowledgment:
|
||||
* "This product includes software developed by the
|
||||
* Apache Software Foundation (http://www.apache.org/)."
|
||||
* Alternately, this acknowledgment may appear in the software itself,
|
||||
* if and wherever such third-party acknowledgments normally appear.
|
||||
*
|
||||
* 4. The names "Apache" and "Apache Software Foundation" and
|
||||
* "Apache Maven" must not be used to endorse or promote products
|
||||
* derived from this software without prior written permission. For
|
||||
* written permission, please contact apache@apache.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "Apache",
|
||||
* "Apache Maven", nor may "Apache" appear in their name, without
|
||||
* prior written permission of the Apache Software Foundation.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Software Foundation. For more
|
||||
* information on the Apache Software Foundation, please see
|
||||
* <http://www.apache.org/>.
|
||||
*
|
||||
* ====================================================================
|
||||
*/
|
||||
|
||||
// java imports
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.FilenameFilter;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.betwixt.io.BeanWriter;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.maven.linkcheck.validation.FileLinkValidator;
|
||||
import org.apache.maven.linkcheck.validation.HTTPLinkValidator;
|
||||
import org.apache.maven.linkcheck.validation.LinkValidatorManager;
|
||||
import org.apache.maven.linkcheck.validation.MailtoLinkValidator;
|
||||
|
||||
/**
|
||||
* Change log task. It uses a ChangeLogGenerator and ChangeLogParser to create
|
||||
* a Collection of ChangeLogEntry objects, which are used to produce an XML
|
||||
* output that represents the list of changes.
|
||||
*
|
||||
* @author <a href="mailto:ben@walding.com">Ben Walding</a>
|
||||
* @version $Id: LinkCheck.java,v 1.1 2003/01/30 10:58:08 bwalding Exp $
|
||||
*/
|
||||
public class LinkCheck {
|
||||
/** Log */
|
||||
private static final Log LOG = LogFactory.getLog(LinkCheck.class);
|
||||
|
||||
/**
|
||||
* Output file for xml document
|
||||
*/
|
||||
private File output;
|
||||
|
||||
/** output encoding for the xml document */
|
||||
private String outputEncoding;
|
||||
|
||||
private File baseDir;
|
||||
private String cache;
|
||||
private String exclude;
|
||||
|
||||
/**
|
||||
* Set the base directory for the change log generator.
|
||||
* @param base the base directory
|
||||
*/
|
||||
public void setBasedir(File base) {
|
||||
this.baseDir = base;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the base directory for the change log generator.
|
||||
*
|
||||
* @return the base directory
|
||||
*/
|
||||
public File getBasedir() {
|
||||
return baseDir;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the output file for the log.
|
||||
* @param output the output file
|
||||
*/
|
||||
public void setOutput(File output) {
|
||||
this.output = output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute task.
|
||||
* @throws FileNotFoundException if {@link ChangeLog#base} doesn't exist
|
||||
* @throws IOException if there are problems running CVS
|
||||
* @throws UnsupportedEncodingException if the underlying platform doesn't
|
||||
* support ISO-8859-1 encoding
|
||||
*/
|
||||
List filesToCheck = null; //of FileToCheck
|
||||
public void doExecute()
|
||||
throws Exception {
|
||||
if (output == null) {
|
||||
throw new NullPointerException("output must be set");
|
||||
}
|
||||
LinkValidatorManager lvm = getLinkValidatorManager();
|
||||
|
||||
filesToCheck = new ArrayList();
|
||||
lvm.loadCache(cache);
|
||||
List files = new ArrayList();
|
||||
findFiles(files, baseDir);
|
||||
Iterator fileIter = files.iterator();
|
||||
while (fileIter.hasNext()) {
|
||||
FileToCheck flc = (FileToCheck) fileIter.next();
|
||||
try {
|
||||
filesToCheck.add(flc);
|
||||
flc.check(lvm);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
createDocument(files);
|
||||
lvm.saveCache(cache);
|
||||
}
|
||||
|
||||
public List getFiles() {
|
||||
LOG.info("About to write " + filesToCheck.size() + " file entries");
|
||||
return filesToCheck;
|
||||
}
|
||||
|
||||
public void findFiles(List allFiles, File base) {
|
||||
FilenameFilter ff = new FilenameFilter() {
|
||||
/**
|
||||
* @see java.io.FilenameFilter#accept(java.io.File, java.lang.String)
|
||||
*/
|
||||
public boolean accept(File dir, String name) {
|
||||
File n = new File(dir, name);
|
||||
if (n.isDirectory())
|
||||
return true;
|
||||
|
||||
if (name.endsWith(".html"))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
File[] f = base.listFiles(ff);
|
||||
|
||||
if (f != null) {
|
||||
for (int i = 0; i < f.length; i++) {
|
||||
File file = f[i];
|
||||
if (file.isDirectory()) {
|
||||
findFiles(allFiles, file);
|
||||
} else {
|
||||
allFiles.add(new FileToCheck(baseDir, file));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the XML document from the currently available details
|
||||
* @throws FileNotFoundException when the output file previously provided
|
||||
* does not exist
|
||||
* @throws UnsupportedEncodingException when the platform doesn't support
|
||||
* ISO-8859-1 encoding
|
||||
*/
|
||||
private void createDocument(List files) throws Exception {
|
||||
PrintWriter out =
|
||||
new PrintWriter(
|
||||
new OutputStreamWriter(
|
||||
new FileOutputStream(output),
|
||||
getOutputEncoding()));
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
buffer
|
||||
.append("<?xml version=\"1.0\" encoding=\"")
|
||||
.append(getOutputEncoding())
|
||||
.append("\" ?>\n");
|
||||
|
||||
|
||||
BeanWriter bw = new BeanWriter(out);
|
||||
bw.writeXmlDeclaration(buffer.toString());
|
||||
bw.setWriteIDs(false);
|
||||
bw.enablePrettyPrint();
|
||||
bw.write(this);
|
||||
out.close();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the outputEncoding.
|
||||
* @return String
|
||||
*/
|
||||
public String getOutputEncoding() {
|
||||
return outputEncoding;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the outputEncoding.
|
||||
* @param outputEncoding The outputEncoding to set
|
||||
*/
|
||||
public void setOutputEncoding(String outputEncoding) {
|
||||
this.outputEncoding = outputEncoding;
|
||||
}
|
||||
|
||||
|
||||
LinkValidatorManager lvm = null;
|
||||
public LinkValidatorManager getLinkValidatorManager() {
|
||||
if (lvm == null) {
|
||||
lvm = new LinkValidatorManager();
|
||||
lvm.setExclude(exclude);
|
||||
lvm.addLinkValidator(new FileLinkValidator());
|
||||
lvm.addLinkValidator(new HTTPLinkValidator());
|
||||
lvm.addLinkValidator(new MailtoLinkValidator());
|
||||
lvm.loadCache(cache);
|
||||
}
|
||||
return lvm;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the cacheFile.
|
||||
* @return String
|
||||
*/
|
||||
public String getCache() {
|
||||
return cache;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the cacheFile.
|
||||
* @param cacheFile The cacheFile to set
|
||||
*/
|
||||
public void setCache(String cache) {
|
||||
this.cache = cache;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the exclude.
|
||||
* @return String
|
||||
*/
|
||||
public String getExclude() {
|
||||
return exclude;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the exclude.
|
||||
* @param exclude The exclude to set
|
||||
*/
|
||||
public void setExclude(String exclude) {
|
||||
this.exclude = exclude;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<info>
|
||||
<element name="result">
|
||||
<attribute name="status" property="status"/>
|
||||
<attribute name="target" property="target"/>
|
||||
</element>
|
||||
</info>
|
||||
@@ -0,0 +1,102 @@
|
||||
package org.apache.maven.linkcheck;
|
||||
|
||||
/* ====================================================================
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 2002 The Apache Software Foundation. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. The end-user documentation included with the redistribution,
|
||||
* if any, must include the following acknowledgment:
|
||||
* "This product includes software developed by the
|
||||
* Apache Software Foundation (http://www.apache.org/)."
|
||||
* Alternately, this acknowledgment may appear in the software itself,
|
||||
* if and wherever such third-party acknowledgments normally appear.
|
||||
*
|
||||
* 4. The names "Apache" and "Apache Software Foundation" and
|
||||
* "Apache Maven" must not be used to endorse or promote products
|
||||
* derived from this software without prior written permission. For
|
||||
* written permission, please contact apache@apache.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "Apache",
|
||||
* "Apache Maven", nor may "Apache" appear in their name, without
|
||||
* prior written permission of the Apache Software Foundation.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Software Foundation. For more
|
||||
* information on the Apache Software Foundation, please see
|
||||
* <http://www.apache.org/>.
|
||||
*
|
||||
* ====================================================================
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @author Ben Walding
|
||||
*
|
||||
*/
|
||||
public class LinkCheckResult {
|
||||
private String status;
|
||||
private String target;
|
||||
|
||||
/**
|
||||
* Returns the status.
|
||||
* @return String
|
||||
*/
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the status.
|
||||
* @param status The status to set
|
||||
*/
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the target.
|
||||
* @return String
|
||||
*/
|
||||
public String getTarget() {
|
||||
return target;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the target.
|
||||
* @param target The target to set
|
||||
*/
|
||||
public void setTarget(String target) {
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<linkcheck>
|
||||
<file name="asd.html">
|
||||
<link
|
||||
url="bob"
|
||||
status="OK"/>
|
||||
</file>
|
||||
</linkcheck>
|
||||
@@ -0,0 +1,55 @@
|
||||
package org.apache.maven.linkcheck.validation;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* @author Ben Walding
|
||||
*
|
||||
*/
|
||||
public class FileLinkValidator implements LinkValidator {
|
||||
private final static LinkValidationResult LVR_INVALID =
|
||||
new LinkValidationResult(LinkValidationResult.INVALID, false);
|
||||
|
||||
private final static LinkValidationResult LVR_VALID =
|
||||
new LinkValidationResult(LinkValidationResult.VALID, false);
|
||||
|
||||
/**
|
||||
* @see org.apache.maven.linkcheck.LinkValidator#validateLink(org.apache.maven.linkcheck.LinkValidationItem)
|
||||
*/
|
||||
public LinkValidationResult validateLink(LinkValidationItem lvi) {
|
||||
File f = getFile(lvi);
|
||||
|
||||
if (f.exists())
|
||||
return LVR_VALID;
|
||||
else
|
||||
return LVR_INVALID;
|
||||
}
|
||||
|
||||
protected File getFile(LinkValidationItem lvi) {
|
||||
String link = lvi.getLink();
|
||||
if (link.indexOf('#') != -1) {
|
||||
link = link.substring(0, link.indexOf('#'));
|
||||
|
||||
//If the link was just #fred or similar, then the file is the file it came from
|
||||
//XXX: Theoretically we could even validate the anchor tag?
|
||||
if (link.trim().length() == 0)
|
||||
return lvi.getSource();
|
||||
}
|
||||
|
||||
File f = new File(lvi.getSource().getParentFile(), link);
|
||||
return f;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.apache.maven.linkcheck.LinkValidator#getResourceKey(org.apache.maven.linkcheck.LinkValidationItem)
|
||||
*/
|
||||
public Object getResourceKey(LinkValidationItem lvi) {
|
||||
String link = lvi.getLink();
|
||||
|
||||
if (link.indexOf(':') != -1)
|
||||
return null;
|
||||
|
||||
return getFile(lvi).getAbsolutePath();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package org.apache.maven.linkcheck.validation;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import com.meterware.httpunit.GetMethodWebRequest;
|
||||
import com.meterware.httpunit.WebConversation;
|
||||
import com.meterware.httpunit.WebRequest;
|
||||
import com.meterware.httpunit.WebResponse;
|
||||
|
||||
/**
|
||||
* @author Ben Walding
|
||||
*
|
||||
*/
|
||||
public class HTTPLinkValidator implements LinkValidator {
|
||||
/**
|
||||
* Log for debug output
|
||||
*/
|
||||
private static Log LOG = LogFactory.getLog(HTTPLinkValidator.class);
|
||||
|
||||
private final static LinkValidationResult LVR_INVALID =
|
||||
new LinkValidationResult(LinkValidationResult.INVALID, true);
|
||||
|
||||
private final static LinkValidationResult LVR_VALID =
|
||||
new LinkValidationResult(LinkValidationResult.VALID, true);
|
||||
|
||||
/**
|
||||
* @see org.apache.maven.linkcheck.LinkValidator#validateLink(org.apache.maven.linkcheck.LinkValidationItem)
|
||||
*/
|
||||
public LinkValidationResult validateLink(LinkValidationItem lvi) {
|
||||
try {
|
||||
String link = lvi.getLink();
|
||||
LOG.debug("Checking web link:" + link);
|
||||
WebConversation wc = new WebConversation();
|
||||
wc.setExceptionsThrownOnErrorStatus(false);
|
||||
WebRequest req = new GetMethodWebRequest(link);
|
||||
WebResponse resp = wc.getResponse(req);
|
||||
|
||||
//FIXME: This constant is defined somewhere, but I can't remember where...
|
||||
if (resp.getResponseCode() == 200) {
|
||||
return LVR_VALID;
|
||||
} else {
|
||||
return LVR_INVALID;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOG.warn("Error accessing " + lvi.getLink(), e);
|
||||
e.printStackTrace();
|
||||
return LVR_INVALID;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.apache.maven.linkcheck.LinkValidator#getResourceKey(org.apache.maven.linkcheck.LinkValidationItem)
|
||||
*/
|
||||
public Object getResourceKey(LinkValidationItem lvi) {
|
||||
String link = lvi.getLink();
|
||||
|
||||
if (!link.startsWith("http://"))
|
||||
return null;
|
||||
|
||||
int hashPos = link.indexOf("#");
|
||||
if (hashPos != -1)
|
||||
link = link.substring(0, hashPos);
|
||||
|
||||
return link;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package org.apache.maven.linkcheck.validation;
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* @author Ben Walding
|
||||
*
|
||||
*/
|
||||
public class LinkValidationItem {
|
||||
private File source;
|
||||
private String link;
|
||||
|
||||
public LinkValidationItem(File source, String link) {
|
||||
if (source == null) {
|
||||
throw new NullPointerException("source can't be null");
|
||||
}
|
||||
|
||||
if (link == null) {
|
||||
throw new NullPointerException("link can't be null");
|
||||
}
|
||||
|
||||
this.source = source;
|
||||
this.link = link;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
*/
|
||||
public boolean equals(Object obj) {
|
||||
LinkValidationItem lvi = (LinkValidationItem) obj;
|
||||
|
||||
if (!lvi.link.equals(link))
|
||||
return false;
|
||||
|
||||
if (!lvi.source.equals(source))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see java.lang.Object#hashCode()
|
||||
*/
|
||||
public int hashCode() {
|
||||
return source.hashCode() ^ link.hashCode();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the link.
|
||||
* @return String
|
||||
*/
|
||||
public String getLink() {
|
||||
return link;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the source.
|
||||
* @return File
|
||||
*/
|
||||
public File getSource() {
|
||||
return source;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the link.
|
||||
* @param link The link to set
|
||||
*/
|
||||
public void setLink(String link) {
|
||||
this.link = link;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the source.
|
||||
* @param source The source to set
|
||||
*/
|
||||
public void setSource(File source) {
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package org.apache.maven.linkcheck.validation;
|
||||
|
||||
/**
|
||||
* @author Ben Walding
|
||||
*
|
||||
* <b>This is an immutable class.</b><br/>
|
||||
* <p>
|
||||
* This class is used to return status responses from the
|
||||
* validation handlers. A persistent result means that it
|
||||
* can be stored in the persistent cache and used across runs.
|
||||
* </p>
|
||||
*/
|
||||
public class LinkValidationResult {
|
||||
public static final int NOTMINE = 0;
|
||||
public static final int INVALID = 1;
|
||||
public static final int VALID = 2;
|
||||
public static final int UNKNOWN = 3;
|
||||
|
||||
private int status = UNKNOWN;
|
||||
|
||||
public LinkValidationResult(int status, boolean persistent) {
|
||||
this.status = status;
|
||||
this.persistent = persistent;
|
||||
}
|
||||
|
||||
boolean persistent;
|
||||
public boolean isPersistent() {
|
||||
return persistent;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the status.
|
||||
* @return int
|
||||
*/
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package org.apache.maven.linkcheck.validation;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* @author Ben Walding
|
||||
*
|
||||
*/
|
||||
public interface LinkValidator {
|
||||
|
||||
/**
|
||||
* If getResource(lvi) returned null, this will NOT be called.
|
||||
* @param lvi
|
||||
* @return int
|
||||
* @throws Exception
|
||||
*/
|
||||
public LinkValidationResult validateLink(LinkValidationItem lvi) throws Exception;
|
||||
|
||||
|
||||
/**
|
||||
* The resource key is used by the cache to determine if it really needs to
|
||||
* validate the link. No actual validation should be done at this point.
|
||||
* @param lvi
|
||||
* @return Object null if this validator should not be doing this work.
|
||||
* @throws Exception
|
||||
*/
|
||||
public Object getResourceKey(LinkValidationItem lvi);
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
package org.apache.maven.linkcheck.validation;
|
||||
|
||||
/* ====================================================================
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 2002 The Apache Software Foundation. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. The end-user documentation included with the redistribution,
|
||||
* if any, must include the following acknowledgment:
|
||||
* "This product includes software developed by the
|
||||
* Apache Software Foundation (http://www.apache.org/)."
|
||||
* Alternately, this acknowledgment may appear in the software itself,
|
||||
* if and wherever such third-party acknowledgments normally appear.
|
||||
*
|
||||
* 4. The names "Apache" and "Apache Software Foundation" and
|
||||
* "Apache Maven" must not be used to endorse or promote products
|
||||
* derived from this software without prior written permission. For
|
||||
* written permission, please contact apache@apache.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "Apache",
|
||||
* "Apache Maven", nor may "Apache" appear in their name, without
|
||||
* prior written permission of the Apache Software Foundation.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Software Foundation. For more
|
||||
* information on the Apache Software Foundation, please see
|
||||
* <http://www.apache.org/>.
|
||||
*
|
||||
* ====================================================================
|
||||
*/
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* @author Ben Walding
|
||||
*
|
||||
*/
|
||||
public class LinkValidatorCache {
|
||||
private LinkValidatorManager lvm;
|
||||
private Map cache = new HashMap();
|
||||
|
||||
public LinkValidatorCache(LinkValidatorManager lvm) {
|
||||
this.lvm = lvm;
|
||||
}
|
||||
public void setCachedResult(Object resourceKey, LinkValidationResult lvr) {
|
||||
cache.put(resourceKey, lvr);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param lvi
|
||||
* @return int Will return a status level, VALID, INVALID, UNKNOWN
|
||||
*/
|
||||
public LinkValidationResult getCachedResult(LinkValidationItem lvi) {
|
||||
Iterator iter = lvm.getValidators().iterator();
|
||||
|
||||
while (iter.hasNext()) {
|
||||
LinkValidator lv = (LinkValidator) iter.next();
|
||||
|
||||
Object resourceKey = lv.getResourceKey(lvi);
|
||||
|
||||
if (resourceKey != null) {
|
||||
return (LinkValidationResult) cache.get(resourceKey);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
public void load(InputStream is) {
|
||||
final LinkValidationResult LVR_VALID =
|
||||
new LinkValidationResult(LinkValidationResult.VALID, true);
|
||||
final LinkValidationResult LVR_INVALID =
|
||||
new LinkValidationResult(LinkValidationResult.INVALID, true);
|
||||
try {
|
||||
Properties p = new Properties();
|
||||
p.load(is);
|
||||
|
||||
Iterator iter = p.keySet().iterator();
|
||||
while (iter.hasNext()) {
|
||||
String key = (String) iter.next();
|
||||
String value = (String) p.getProperty(key);
|
||||
|
||||
if (value.equals("VALID"))
|
||||
cache.put(key, LVR_VALID);
|
||||
|
||||
if (value.equals("INVALID"))
|
||||
cache.put(key, LVR_INVALID);
|
||||
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void save(OutputStream os) {
|
||||
|
||||
try {
|
||||
Properties p = new Properties();
|
||||
Iterator iter = cache.keySet().iterator();
|
||||
while (iter.hasNext()) {
|
||||
String key = (String) iter.next();
|
||||
LinkValidationResult lvr =
|
||||
(LinkValidationResult) cache.get(key);
|
||||
if (lvr.isPersistent()) {
|
||||
if (lvr.getStatus() == LinkValidationResult.VALID) {
|
||||
p.setProperty(key, "VALID");
|
||||
}
|
||||
|
||||
if (lvr.getStatus() == LinkValidationResult.INVALID) {
|
||||
p.setProperty(key, "INVALID");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
p.store(os, "LinkCheck Cache");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,169 @@
|
||||
package org.apache.maven.linkcheck.validation;
|
||||
/* ====================================================================
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 2002 The Apache Software Foundation. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. The end-user documentation included with the redistribution,
|
||||
* if any, must include the following acknowledgment:
|
||||
* "This product includes software developed by the
|
||||
* Apache Software Foundation (http://www.apache.org/)."
|
||||
* Alternately, this acknowledgment may appear in the software itself,
|
||||
* if and wherever such third-party acknowledgments normally appear.
|
||||
*
|
||||
* 4. The names "Apache" and "Apache Software Foundation" and
|
||||
* "Apache Maven" must not be used to endorse or promote products
|
||||
* derived from this software without prior written permission. For
|
||||
* written permission, please contact apache@apache.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "Apache",
|
||||
* "Apache Maven", nor may "Apache" appear in their name, without
|
||||
* prior written permission of the Apache Software Foundation.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Software Foundation. For more
|
||||
* information on the Apache Software Foundation, please see
|
||||
* <http://www.apache.org/>.
|
||||
*
|
||||
* ====================================================================
|
||||
*/
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
/**
|
||||
* @author Ben Walding
|
||||
*
|
||||
*/
|
||||
|
||||
public class LinkValidatorManager {
|
||||
/**
|
||||
* Log for debug output
|
||||
*/
|
||||
private static Log LOG = LogFactory.getLog(LinkValidatorManager.class);
|
||||
|
||||
private List validators = new ArrayList();
|
||||
private LinkValidatorCache cache = new LinkValidatorCache(this);
|
||||
private String exclude;
|
||||
|
||||
public LinkValidatorManager() {
|
||||
|
||||
}
|
||||
|
||||
public void addLinkValidator(LinkValidator lv) {
|
||||
validators.add(lv);
|
||||
}
|
||||
|
||||
public List getValidators() {
|
||||
return validators;
|
||||
}
|
||||
|
||||
public LinkValidationResult validateLink(LinkValidationItem lvi)
|
||||
throws Exception {
|
||||
{
|
||||
LinkValidationResult status = cache.getCachedResult(lvi);
|
||||
if (status != null) {
|
||||
return status;
|
||||
}
|
||||
}
|
||||
|
||||
if (exclude != null && lvi.getLink().startsWith(exclude)) {
|
||||
return new LinkValidationResult(LinkValidationResult.VALID, false);
|
||||
}
|
||||
|
||||
Iterator iter = validators.iterator();
|
||||
while (iter.hasNext()) {
|
||||
LinkValidator lv = (LinkValidator) iter.next();
|
||||
|
||||
Object resourceKey = lv.getResourceKey(lvi);
|
||||
|
||||
if (resourceKey != null) {
|
||||
|
||||
LinkValidationResult lvr = lv.validateLink(lvi);
|
||||
|
||||
if (lvr.getStatus() == LinkValidationResult.NOTMINE) {
|
||||
continue;
|
||||
}
|
||||
|
||||
cache.setCachedResult(resourceKey, lvr);
|
||||
return lvr;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
LOG.info("Unable to validate link : " + lvi.getLink());
|
||||
return new LinkValidationResult(LinkValidationResult.UNKNOWN, false);
|
||||
}
|
||||
|
||||
public void loadCache(String cacheFilename) {
|
||||
try {
|
||||
File f = new File(cacheFilename);
|
||||
if (f.exists()) {
|
||||
this.cache.load(new FileInputStream(cacheFilename));
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void saveCache(String cacheFilename) {
|
||||
try {
|
||||
this.cache.save(new FileOutputStream(cacheFilename));
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the exclude.
|
||||
* @return String
|
||||
*/
|
||||
public String getExclude() {
|
||||
return exclude;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the exclude.
|
||||
* @param exclude The exclude to set
|
||||
*/
|
||||
public void setExclude(String exclude) {
|
||||
this.exclude = exclude;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package org.apache.maven.linkcheck.validation;
|
||||
|
||||
/**
|
||||
* @author Ben Walding
|
||||
*
|
||||
*/
|
||||
public class MailtoLinkValidator implements LinkValidator {
|
||||
private static final LinkValidationResult LVR =
|
||||
new LinkValidationResult(LinkValidationResult.VALID, false);
|
||||
/**
|
||||
* @see org.apache.maven.linkcheck.validation.LinkValidator#validateLink(org.apache.maven.linkcheck.validation.LinkValidationItem)
|
||||
*/
|
||||
public LinkValidationResult validateLink(LinkValidationItem lvi)
|
||||
throws Exception {
|
||||
return LVR;
|
||||
}
|
||||
/**
|
||||
* @see org.apache.maven.linkcheck.validation.LinkValidator#getResourceKey(org.apache.maven.linkcheck.validation.LinkValidationItem)
|
||||
*/
|
||||
public Object getResourceKey(LinkValidationItem lvi) {
|
||||
return lvi.getLink();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package org.apache.maven.linkcheck.validation;
|
||||
|
||||
/**
|
||||
* @author Ben Walding
|
||||
*
|
||||
*/
|
||||
public class ValidationResult {
|
||||
|
||||
}
|
||||
15
linkcheck/src/plugin-resources/linkcheck-temp.xml
Normal file
15
linkcheck/src/plugin-resources/linkcheck-temp.xml
Normal file
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0"?>
|
||||
<document>
|
||||
<properties>
|
||||
<title>Maven LinkCheck Plug-in</title>
|
||||
<author email="ben@walding.com">Ben Walding</author>
|
||||
</properties>
|
||||
|
||||
<body>
|
||||
<section name="Maven LinkCheck Temporary File">
|
||||
<p>
|
||||
This file is used as a placeholder until the final link check can occur.
|
||||
</p>
|
||||
</section>
|
||||
</body>
|
||||
</document>
|
||||
52
linkcheck/src/plugin-resources/linkcheck.jsl
Normal file
52
linkcheck/src/plugin-resources/linkcheck.jsl
Normal file
@@ -0,0 +1,52 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<jsl:stylesheet
|
||||
select="$doc"
|
||||
xmlns:j="jelly:core"
|
||||
xmlns:util="jelly:util"
|
||||
xmlns:jsl="jelly:jsl"
|
||||
xmlns:x="jelly:xml"
|
||||
xmlns="dummy"
|
||||
trim="false">
|
||||
|
||||
<jsl:template match="linkcheck">
|
||||
<document>
|
||||
|
||||
<properties>
|
||||
<title>Link Check Report</title>
|
||||
</properties>
|
||||
<body>
|
||||
<section name="Link Check Report">
|
||||
<table>
|
||||
<tr>
|
||||
<th>URL</th>
|
||||
</tr>
|
||||
<x:set var="files" select="file[@unsuccessful!=0]"/>
|
||||
<j:forEach var="file" items="${files}">
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<util:replace var="name" oldChar="\\" newChar="/">
|
||||
${file.attribute('name').value}
|
||||
</util:replace>
|
||||
<a href="${name}">${name}</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<x:forEach var="result" select="$file/result">
|
||||
<j:set var="status"><x:expr select="$result/@status"/></j:set>
|
||||
<j:set var="target"><x:expr select="$result/@target"/></j:set>
|
||||
<j:if test="${status != 'OK'}">
|
||||
<span style="pad-left:60px">${status} - ${target}</span>
|
||||
<br/>
|
||||
</j:if>
|
||||
</x:forEach>
|
||||
</td>
|
||||
</tr>
|
||||
</j:forEach>
|
||||
</table>
|
||||
</section>
|
||||
</body>
|
||||
</document>
|
||||
</jsl:template>
|
||||
</jsl:stylesheet>
|
||||
7
linkcheck/src/test-resources/nolink.html
Normal file
7
linkcheck/src/test-resources/nolink.html
Normal file
@@ -0,0 +1,7 @@
|
||||
<html>
|
||||
<body>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
6
linkcheck/src/test-resources/test-resources/nolink.html
Normal file
6
linkcheck/src/test-resources/test-resources/nolink.html
Normal file
@@ -0,0 +1,6 @@
|
||||
<html>
|
||||
<body>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
0
linkcheck/src/test-resources/test1/test1.html
Normal file
0
linkcheck/src/test-resources/test1/test1.html
Normal file
5
linkcheck/src/test-resources/testA.html
Normal file
5
linkcheck/src/test-resources/testA.html
Normal file
@@ -0,0 +1,5 @@
|
||||
<a href="#bumpkin">test2</a>
|
||||
|
||||
|
||||
|
||||
<a href="testnothere.html">test that isn't here</a>
|
||||
@@ -0,0 +1,95 @@
|
||||
package org.apache.maven.linkcheck;
|
||||
|
||||
/* ====================================================================
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 2002 The Apache Software Foundation. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. The end-user documentation included with the redistribution,
|
||||
* if any, must include the following acknowledgment:
|
||||
* "This product includes software developed by the
|
||||
* Apache Software Foundation (http://www.apache.org/)."
|
||||
* Alternately, this acknowledgment may appear in the software itself,
|
||||
* if and wherever such third-party acknowledgments normally appear.
|
||||
*
|
||||
* 4. The names "Apache" and "Apache Software Foundation" and
|
||||
* "Apache Maven" must not be used to endorse or promote products
|
||||
* derived from this software without prior written permission. For
|
||||
* written permission, please contact apache@apache.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "Apache",
|
||||
* "Apache Maven", nor may "Apache" appear in their name, without
|
||||
* prior written permission of the Apache Software Foundation.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Software Foundation. For more
|
||||
* information on the Apache Software Foundation, please see
|
||||
* <http://www.apache.org/>.
|
||||
*
|
||||
* ====================================================================
|
||||
*/
|
||||
import java.io.File;
|
||||
import java.util.Iterator;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
/**
|
||||
* @author Ben Walding
|
||||
*
|
||||
*/
|
||||
public class LinkCheckTest extends TestCase {
|
||||
String baseDir;
|
||||
|
||||
public void setUp() {
|
||||
baseDir = System.getProperty("basedir");
|
||||
}
|
||||
|
||||
public void testScan()
|
||||
throws Exception {
|
||||
File f = new File(baseDir + "/src/test-resources");
|
||||
LinkCheck lc = new LinkCheck();
|
||||
lc.setBasedir(f);
|
||||
lc.setOutput(new File(baseDir + "/target/linkcheck.xml"));
|
||||
lc.setOutputEncoding("ISO8859-1");
|
||||
lc.setCache(baseDir + "/target/linkcheck-cache.xml");
|
||||
lc.doExecute();
|
||||
|
||||
|
||||
Iterator iter = lc.getFiles().iterator();
|
||||
while (iter.hasNext()) {
|
||||
FileToCheck ftc = (FileToCheck) iter.next();
|
||||
System.out.println(ftc.getName());
|
||||
}
|
||||
|
||||
//Iterator iter = Collections.EMPTY_LIST.iterator();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
1
linkcheck/xdocs/.cvsignore
Normal file
1
linkcheck/xdocs/.cvsignore
Normal file
@@ -0,0 +1 @@
|
||||
stylesheets
|
||||
20
linkcheck/xdocs/goals.xml
Normal file
20
linkcheck/xdocs/goals.xml
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<document>
|
||||
<properties>
|
||||
<title>Maven Link Check Plug-in Goals</title>
|
||||
<author email="ben@walding.com">Ben Walding</author>
|
||||
</properties>
|
||||
<body>
|
||||
<goals>
|
||||
<goal>
|
||||
<name>linkcheck</name>
|
||||
<description></description>
|
||||
</goal>
|
||||
<goal>
|
||||
<name>report</name>
|
||||
<description></description>
|
||||
</goal>
|
||||
</goals>
|
||||
</body>
|
||||
</document>
|
||||
29
linkcheck/xdocs/index.xml
Normal file
29
linkcheck/xdocs/index.xml
Normal file
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0"?>
|
||||
<document>
|
||||
<properties>
|
||||
<title>Maven LinkCheck Plug-in</title>
|
||||
<author email="ben@walding.com">Ben Walding</author>
|
||||
</properties>
|
||||
|
||||
<body>
|
||||
<section name="Maven LinkCheck Plug-in">
|
||||
<p>
|
||||
This plug-in validates the HTML that is produced as part of the site
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<section name="Future Features">
|
||||
<p>
|
||||
This section holds a list of possible future features that might be nice
|
||||
to have implemented. (In decreasing order of importance)
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<ol>
|
||||
<li>The ability to include exclude parts of the tree</li>
|
||||
<li>Persists remote url checks across runs</li>
|
||||
</ol>
|
||||
</p>
|
||||
</section>
|
||||
</body>
|
||||
</document>
|
||||
17
linkcheck/xdocs/navigation.xml
Normal file
17
linkcheck/xdocs/navigation.xml
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<project name="Maven Link Check Plugin">
|
||||
<title>Maven junit-report Plugin</title>
|
||||
<body>
|
||||
<links>
|
||||
<item href="http://jakarta.apache.org/turbine/maven/" name="Maven">
|
||||
</item>
|
||||
</links>
|
||||
<menu name="Overview">
|
||||
<item href="/goals.html" name="Goals">
|
||||
</item>
|
||||
<item href="/properties.html" name="Properties">
|
||||
</item>
|
||||
</menu>
|
||||
</body>
|
||||
</project>
|
||||
83
linkcheck/xdocs/properties.xml
Normal file
83
linkcheck/xdocs/properties.xml
Normal file
@@ -0,0 +1,83 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<document>
|
||||
<properties>
|
||||
<title>junit-report Properties</title>
|
||||
<author email="dion@apache.org">dIon Gillard</author>
|
||||
</properties>
|
||||
<body>
|
||||
<section name="junit-report Settings">
|
||||
<table>
|
||||
<tr>
|
||||
<th>Property</th>
|
||||
<th>Optional?</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>maven.linkcheck.enable</td>
|
||||
<td>Yes</td>
|
||||
<td>If defined, the report is enabled
|
||||
<p>Default value is
|
||||
<code>undefined</code>.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>maven.linkcheck.baseurl</td>
|
||||
<td>No</td>
|
||||
<td>Used to create links to live documents
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>maven.conf.dir</td>
|
||||
<td>Yes</td>
|
||||
<td>
|
||||
<p>Default value is
|
||||
<code>${basedir}/conf</code>.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>maven.gen.docs</td>
|
||||
<td>Yes</td>
|
||||
<td>
|
||||
<p>Default value is
|
||||
<code>${maven.build.dir}/generated-xdocs</code>.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>maven.docs.src</td>
|
||||
<td>Yes</td>
|
||||
<td>
|
||||
<p>Default value is
|
||||
<code>${basedir}/xdocs</code>.</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>maven.build.dir</td>
|
||||
<td>Yes</td>
|
||||
<td>
|
||||
<p>Default value is
|
||||
<code>${basedir}/target</code>.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>maven.docs.dest</td>
|
||||
<td>Yes</td>
|
||||
<td>
|
||||
<p>Default value is
|
||||
<code>${maven.build.dir}/docs</code>.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>maven.docs.outputencoding</td>
|
||||
<td>Yes</td>
|
||||
<td>
|
||||
<p>Default value is
|
||||
<code>ISO-8859-1</code>.</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</section>
|
||||
</body>
|
||||
</document>
|
||||
Reference in New Issue
Block a user