You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by ca...@apache.org on 2004/07/26 18:16:35 UTC
cvs commit: maven-plugins/linkcheck/src/test-resources testExcludes.html
carlos 2004/07/26 09:16:35
Modified: linkcheck/xdocs properties.xml index.xml changes.xml
linkcheck/src/main/org/apache/maven/linkcheck/validation
LinkValidatorManager.java
linkcheck plugin.jelly plugin.properties project.xml
linkcheck/src/test/org/apache/maven/linkcheck
LinkCheckTest.java
linkcheck/src/main/org/apache/maven/linkcheck LinkCheck.java
Added: linkcheck/src/test-resources testExcludes.html
Log:
Added maven.linkcheck.exclude property
Revision Changes Path
1.8 +9 -0 maven-plugins/linkcheck/xdocs/properties.xml
Index: properties.xml
===================================================================
RCS file: /home/cvs/maven-plugins/linkcheck/xdocs/properties.xml,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- properties.xml 2 May 2004 11:15:40 -0000 1.7
+++ properties.xml 26 Jul 2004 16:16:34 -0000 1.8
@@ -50,6 +50,15 @@
Defaults to <code>false</code>.
</td>
</tr>
+ <tr>
+ <td>maven.linkcheck.exclude</td>
+ <td>Yes</td>
+ <td>
+ List of urls to exclude from check, delimited by comma, space or tab.
+ Those urls in files that start with one of the excluded urls will be ignored.
+ Defaults to <code>pom.repository.url</code>.
+ </td>
+ </tr>
</table>
</section>
</body>
1.3 +2 -1 maven-plugins/linkcheck/xdocs/index.xml
Index: index.xml
===================================================================
RCS file: /home/cvs/maven-plugins/linkcheck/xdocs/index.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- index.xml 4 Mar 2004 18:36:32 -0000 1.2
+++ index.xml 26 Jul 2004 16:16:34 -0000 1.3
@@ -26,7 +26,8 @@
<body>
<section name="Maven LinkCheck Plug-in">
<p>
- This plug-in validates the HTML that is produced as part of the site
+ This plug-in validates the HTML that is produced as part of the site.
+ Just add the maven-linkcheck-plugin report to your project.
</p>
</section>
1.21 +3 -0 maven-plugins/linkcheck/xdocs/changes.xml
Index: changes.xml
===================================================================
RCS file: /home/cvs/maven-plugins/linkcheck/xdocs/changes.xml,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- changes.xml 11 Jul 2004 02:25:14 -0000 1.20
+++ changes.xml 26 Jul 2004 16:16:34 -0000 1.21
@@ -25,6 +25,9 @@
<author email="vmassol@apache.org">Vincent Massol</author>
</properties>
<body>
+ <release version="1.4-SNAPSHOT" date="in CVS">
+ <action dev="carlos" type="add">Added <code>maven.linkcheck.exclude</code> property</action>
+ </release>
<release version="1.3.2" date="2004-07-10">
<action dev="brett" type="update" issue="MPLINKCHECK-14">Only log exception in debug mode on connection refused</action>
<action dev="brett" type="update">Update commons-*</action>
1.6 +30 -6 maven-plugins/linkcheck/src/main/org/apache/maven/linkcheck/validation/LinkValidatorManager.java
Index: LinkValidatorManager.java
===================================================================
RCS file: /home/cvs/maven-plugins/linkcheck/src/main/org/apache/maven/linkcheck/validation/LinkValidatorManager.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- LinkValidatorManager.java 2 Mar 2004 15:09:17 -0000 1.5
+++ LinkValidatorManager.java 26 Jul 2004 16:16:34 -0000 1.6
@@ -30,6 +30,7 @@
/**
* @author <a href="mailto:bwalding@apache.org">Ben Walding</a>
+ * @author <a href="mailto:carlos@apache.org">Carlos Sanchez</a>
* @version $Id$
*/
@@ -41,7 +42,7 @@
private List validators = new ArrayList();
private LinkValidatorCache cache = new LinkValidatorCache(this);
- private String exclude;
+ private String[] excludes = new String[0];
public LinkValidatorManager() {
@@ -64,8 +65,13 @@
}
}
- if (exclude != null && lvi.getLink().startsWith(exclude)) {
- return new LinkValidationResult(LinkValidationResult.VALID, false);
+ for (int i = 0; i < excludes.length; i++) {
+ if (excludes[i] != null && lvi.getLink().startsWith(excludes[i])) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Excluded " + lvi.getLink());
+ }
+ return new LinkValidationResult(LinkValidationResult.VALID, false);
+ }
}
Iterator iter = validators.iterator();
@@ -120,17 +126,35 @@
/**
* Returns the exclude.
* @return String
+ * @deprecated use getExcludes()
*/
public String getExclude() {
- return exclude;
+ return excludes[0];
}
/**
* Sets the exclude.
* @param exclude The exclude to set
+ * @deprecated use setExcludes()
*/
public void setExclude(String exclude) {
- this.exclude = exclude;
+ this.excludes = new String[] {exclude};
+ }
+
+ /**
+ * Returns the excludes.
+ * @return String[]
+ */
+ public String[] getExcludes() {
+ return excludes;
+ }
+
+ /**
+ * Sets the excludes.
+ * @param excludes The excludes to set
+ */
+ public void setExcludes(String[] excludes) {
+ this.excludes = excludes;
}
}
1.17 +1 -1 maven-plugins/linkcheck/plugin.jelly
Index: plugin.jelly
===================================================================
RCS file: /home/cvs/maven-plugins/linkcheck/plugin.jelly,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- plugin.jelly 2 May 2004 11:15:40 -0000 1.16
+++ plugin.jelly 26 Jul 2004 16:16:34 -0000 1.17
@@ -84,7 +84,7 @@
<linkcheck:linkcheck
project="${pom}"
cache="${maven.linkcheck.cache}"
- exclude="${pom.repository.url}"
+ exclude="${maven.linkcheck.exclude}"
basedir="${maven.docs.dest}"
output="${maven.build.dir}/linkcheck/linkcheck-results.xml"
outputEncoding="${maven.docs.outputencoding}"
1.6 +1 -0 maven-plugins/linkcheck/plugin.properties
Index: plugin.properties
===================================================================
RCS file: /home/cvs/maven-plugins/linkcheck/plugin.properties,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- plugin.properties 2 May 2004 11:15:40 -0000 1.5
+++ plugin.properties 26 Jul 2004 16:16:34 -0000 1.6
@@ -19,3 +19,4 @@
# -------------------------------------------------------------------
maven.linkcheck.cache=${maven.build.dir}/linkcheck/linkcheck.cache
maven.linkcheck.failonerror=false
+maven.linkcheck.exclude=${pom.repository.url}
1.54 +1 -1 maven-plugins/linkcheck/project.xml
Index: project.xml
===================================================================
RCS file: /home/cvs/maven-plugins/linkcheck/project.xml,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -r1.53 -r1.54
--- project.xml 11 Jul 2004 02:25:14 -0000 1.53
+++ project.xml 26 Jul 2004 16:16:34 -0000 1.54
@@ -23,7 +23,7 @@
<pomVersion>3</pomVersion>
<id>maven-linkcheck-plugin</id>
<name>Maven LinkCheck Plug-in</name>
- <currentVersion>1.3.2</currentVersion>
+ <currentVersion>1.4-SNAPSHOT</currentVersion>
<description>Check xdoc links. Requires Maven 1.0 RC2.</description>
<shortDescription>Check xdoc links</shortDescription>
<url>http://maven.apache.org/reference/plugins/linkcheck/</url>
1.8 +11 -2 maven-plugins/linkcheck/src/test/org/apache/maven/linkcheck/LinkCheckTest.java
Index: LinkCheckTest.java
===================================================================
RCS file: /home/cvs/maven-plugins/linkcheck/src/test/org/apache/maven/linkcheck/LinkCheckTest.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- LinkCheckTest.java 2 Mar 2004 15:09:18 -0000 1.7
+++ LinkCheckTest.java 26 Jul 2004 16:16:35 -0000 1.8
@@ -28,7 +28,7 @@
/**
* @author Ben Walding
- *
+ * @author <a href="mailto:carlos@apache.org">Carlos Sanchez</a>
*/
public class LinkCheckTest extends TestCase
{
@@ -47,6 +47,8 @@
lc.setOutput(new File(baseDir + "/target/linkcheck.xml"));
lc.setOutputEncoding("ISO8859-1");
lc.setCache(baseDir + "/target/linkcheck-cache.xml");
+ lc.setExclude("http://cvs.apache.org/viewcvs.cgi/maven-pluginszz/,"
+ + "http://cvs.apache.org/viewcvs.cgi/mavenzz/");
lc.doExecute();
Iterator iter = lc.getFiles().iterator();
@@ -57,7 +59,7 @@
map.put(ftc.getName(), ftc);
}
- assertEquals("files.size()", 7, lc.getFiles().size());
+ assertEquals("files.size()", 8, lc.getFiles().size());
check(map, "nolink.html", 0);
check(map, "test-resources/nolink.html", 0);
@@ -65,6 +67,13 @@
check(map, "test-resources/test1/test2.html", 0);
check(map, "test1/test1.html", 1);
check(map, "testA.html", 3);
+
+ /* test excludes */
+ String fileName = "testExcludes.html";
+ check(map, fileName, 2);
+
+ FileToCheck ftc = (FileToCheck) map.get(fileName);
+ assertEquals("Excluded links", 2, ftc.getSuccessful());
//index-all.html should get parsed, but is currently having problems.
//check(map, "index-all.html", 1);
1.13 +17 -4 maven-plugins/linkcheck/src/main/org/apache/maven/linkcheck/LinkCheck.java
Index: LinkCheck.java
===================================================================
RCS file: /home/cvs/maven-plugins/linkcheck/src/main/org/apache/maven/linkcheck/LinkCheck.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- LinkCheck.java 2 Mar 2004 15:09:17 -0000 1.12
+++ LinkCheck.java 26 Jul 2004 16:16:35 -0000 1.13
@@ -25,6 +25,7 @@
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+import java.util.StringTokenizer;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -40,6 +41,7 @@
* their links checked.
*
* @author <a href="mailto:bwalding@apache.org">Ben Walding</a>
+ * @author <a href="mailto:carlos@apache.org">Carlos Sanchez</a>
* @version $Id$
*/
public class LinkCheck
@@ -228,7 +230,14 @@
if (lvm == null)
{
lvm = new LinkValidatorManager();
- lvm.setExclude(exclude);
+ if (exclude != null) {
+ StringTokenizer st = new StringTokenizer(exclude, " ,\t\n\r\f");
+ String[] tokens = new String[st.countTokens()];
+ for (int i = 0; i < tokens.length; i++) {
+ tokens[i] = st.nextToken();
+ }
+ lvm.setExcludes(tokens);
+ }
lvm.addLinkValidator(new FileLinkValidator());
MavenJellyContext ctx;
if (getProject() == null) {
@@ -274,8 +283,12 @@
}
/**
- * Sets the exclude.
- * @param exclude The exclude to set
+ * Sets the exclude, a string with exclude locations delimited by the space
+ * character, the comma character, the tab character, the newline character,
+ * the carriage-return character, and the form-feed character.
+ *
+ * @param exclude
+ * The exclude to set
*/
public void setExclude(String exclude)
{
1.1 maven-plugins/linkcheck/src/test-resources/testExcludes.html
Index: testExcludes.html
===================================================================
<!--
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<html>
<body>
<a href="http://cvs.apache.org/viewcvs.cgi/maven-pluginszz/">this will be excluded</a>
<a href="http://cvs.apache.org/viewcvs.cgi/mavenzz/">this will be excluded</a>
</body>
</html>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org