diff --git a/linkcheck/plugin.properties b/linkcheck/plugin.properties index 1b53180e..00587d20 100644 --- a/linkcheck/plugin.properties +++ b/linkcheck/plugin.properties @@ -20,3 +20,9 @@ maven.linkcheck.cache=${maven.build.dir}/linkcheck/linkcheck.cache maven.linkcheck.failonerror=false maven.linkcheck.exclude=${pom.repository.url} +maven.linkcheck.proxy.host=${maven.proxy.host} +maven.linkcheck.proxy.port=${maven.proxy.port} +maven.linkcheck.proxy.username=${maven.proxy.username} +maven.linkcheck.proxy.password=${maven.proxy.password} +maven.linkcheck.proxy.ntlm.host=${maven.proxy.ntlm.host} +maven.linkcheck.proxy.ntlm.domain=${maven.proxy.ntlm.domain} diff --git a/linkcheck/project.properties b/linkcheck/project.properties index b240855c..21a54044 100644 --- a/linkcheck/project.properties +++ b/linkcheck/project.properties @@ -20,12 +20,12 @@ maven.junit.fork=yes # Properties required for the unit tests maven.junit.sysproperties = \ - maven.proxy.host \ - maven.proxy.port \ - maven.proxy.username \ - maven.proxy.password \ - maven.proxy.ntlm.host \ - maven.proxy.ntlm.domain \ + maven.linkcheck.proxy.host \ + maven.linkcheck.proxy.port \ + maven.linkcheck.proxy.username \ + maven.linkcheck.proxy.password \ + maven.linkcheck.proxy.ntlm.host \ + maven.linkcheck.proxy.ntlm.domain \ maven.mode.online maven.jar.override = on diff --git a/linkcheck/src/main/org/apache/maven/plugin/linkcheck/LinkCheck.java b/linkcheck/src/main/org/apache/maven/plugin/linkcheck/LinkCheck.java index 34ff33c4..514c5374 100644 --- a/linkcheck/src/main/org/apache/maven/plugin/linkcheck/LinkCheck.java +++ b/linkcheck/src/main/org/apache/maven/plugin/linkcheck/LinkCheck.java @@ -58,9 +58,17 @@ public final class LinkCheck private static final long MEG = 1024 * 1024; - private static final String MAVEN_PROXY_NTLM_HOST = "maven.proxy.ntlm.host"; + private static final String MAVEN_PROXY_HOST = "maven.linkcheck.proxy.host"; - private static final String MAVEN_PROXY_NTLM_DOMAIN = "maven.proxy.ntlm.domain"; + private static final String MAVEN_PROXY_PORT = "maven.linkcheck.proxy.port"; + + private static final String MAVEN_PROXY_USERNAME = "maven.linkcheck.proxy.username"; + + private static final String MAVEN_PROXY_PASSWORD = "maven.linkcheck.proxy.password"; + + private static final String MAVEN_PROXY_NTLM_HOST = "maven.linkcheck.proxy.ntlm.host"; + + private static final String MAVEN_PROXY_NTLM_DOMAIN = "maven.linkcheck.proxy.ntlm.domain"; private File basedir; @@ -172,10 +180,16 @@ public final class LinkCheck MavenJellyContext ctx = ( (Project) getProject() ).getContext(); if ( ctx.getOnline().booleanValue() ) { - lvm.addLinkValidator( new OnlineHTTPLinkValidator( ctx.getProxyHost(), ctx.getProxyPort(), ctx - .getProxyUserName(), ctx.getProxyPassword(), (String) ctx.getVariable( MAVEN_PROXY_NTLM_HOST ), - (String) ctx - .getVariable( MAVEN_PROXY_NTLM_DOMAIN ) ) ); + lvm + .addLinkValidator( new OnlineHTTPLinkValidator( + (String) ctx.getVariable( MAVEN_PROXY_HOST ), + (String) ctx.getVariable( MAVEN_PROXY_PORT ), + (String) ctx.getVariable( MAVEN_PROXY_USERNAME ), + (String) ctx.getVariable( MAVEN_PROXY_PASSWORD ), + (String) ctx + .getVariable( MAVEN_PROXY_NTLM_HOST ), + (String) ctx + .getVariable( MAVEN_PROXY_NTLM_DOMAIN ) ) ); } else { diff --git a/linkcheck/src/test/org/apache/maven/plugin/linkcheck/validation/HTTPLinkValidatorTest.java b/linkcheck/src/test/org/apache/maven/plugin/linkcheck/validation/HTTPLinkValidatorTest.java index 8a1cbb81..91adb4bd 100644 --- a/linkcheck/src/test/org/apache/maven/plugin/linkcheck/validation/HTTPLinkValidatorTest.java +++ b/linkcheck/src/test/org/apache/maven/plugin/linkcheck/validation/HTTPLinkValidatorTest.java @@ -39,10 +39,11 @@ public class HTTPLinkValidatorTest System.err.println( "maven.mode.online : " + mavenOnline ); if ( mavenOnline ) { - hlv = new OnlineHTTPLinkValidator( System.getProperty( "maven.proxy.host" ), System - .getProperty( "maven.proxy.port" ), System.getProperty( "maven.proxy.username" ), System - .getProperty( "maven.proxy.password" ), System.getProperty( "maven.proxy.ntlm.host" ), System - .getProperty( "maven.proxy.ntlm.domain" ) ); + hlv = new OnlineHTTPLinkValidator( System.getProperty( "maven.linkcheck.proxy.host" ), System + .getProperty( "maven.linkcheck.proxy.port" ), System.getProperty( "maven.linkcheck.proxy.username" ), + System.getProperty( "maven.linkcheck.proxy.password" ), System + .getProperty( "maven.linkcheck.proxy.ntlm.host" ), System + .getProperty( "maven.linkcheck.proxy.ntlm.domain" ) ); assertEquals( LinkValidationResult.VALID, checkLink( "http://www.apache.org" ).getStatus() ); assertEquals( LinkValidationResult.ERROR, checkLink( "http://www.example.com>);" ).getStatus() ); diff --git a/linkcheck/xdocs/changes.xml b/linkcheck/xdocs/changes.xml index 6db8124b..078ab9ae 100644 --- a/linkcheck/xdocs/changes.xml +++ b/linkcheck/xdocs/changes.xml @@ -36,6 +36,7 @@ StackOverflowError processing apidocs/index-all.html. Support NTLM proxies. "Moved Permanently" sites are reported as a warning and not as an error. + linkcheck plugin uses global proxy settings. There is no way to perform check using a proxy while still having a non-proxied project. If maven is in offline mode the report doesn't test external urls. A warning is displayed in the report. Make compatible with Maven 1.1 Update dependencies to match ones in maven 1.1 core and to unify them between plugins. The following dependency is updated : commons-collections v2.1 -> v3.0 diff --git a/linkcheck/xdocs/properties.xml b/linkcheck/xdocs/properties.xml index 92994274..980941cb 100644 --- a/linkcheck/xdocs/properties.xml +++ b/linkcheck/xdocs/properties.xml @@ -58,7 +58,57 @@ Those urls in files that start with one of the excluded urls will be ignored. Defaults to pom.repository.url. - + + + + + maven.linkcheck.proxy.host + Yes + + The IP or address of your proxy. + Defaults to maven.proxy.host. + + + + maven.linkcheck.proxy.port + Yes + + The port number of your proxy. + Defaults to maven.proxy.port. + + + + maven.linkcheck.proxy.username + Yes + + User name if your proxy requires authentication. + Defaults to maven.proxy.username. + + + + maven.linkcheck.proxy.password + Yes + + Password if your proxy requires authentication. + Defaults to maven.proxy.password. + + + + maven.linkcheck.proxy.ntlm.host + Yes + + The host to use if you are using NTLM authentication. + Defaults to maven.proxy.ntlm.host. + + + + maven.linkcheck.proxy.ntlm.domain + Yes + + The NT domain to use if you are using NTLM authentication. + Defaults to maven.proxy.ntlm.domain. + +