Resolving: MNG-968

Applied patches from Lester Ecarma (Thanks, Lester!), and refactored the location property of OfflineLink to be a File type, since this will work more readily for locations on the filesystem. Tested on a local variant of maven-core/pom.xml, and it appears to work fine.



git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@320874 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
John Dennis Casey 2005-10-13 19:06:28 +00:00
parent 1c7c34f027
commit 02c020ad64
2 changed files with 88 additions and 9 deletions

View File

@ -80,7 +80,7 @@ public class JavadocReport
// ----------------------------------------------------------------------
// Mojo Parameters
// ----------------------------------------------------------------------
/**
* @parameter default-value="${settings.offline}"
* @required
@ -360,18 +360,18 @@ public class JavadocReport
* See <a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javadoc.html#link">link</a>.
* It is a comma separated String.
*
* @parameter expression="${link}"
* @parameter expression="${links}"
*/
private String link;
private ArrayList links;
/**
* This option is a variation of -link; they both create links to javadoc-generated documentation for external referenced classes.
* See <a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javadoc.html#linkoffline">linkoffline</a>.
* It is a comma separated String.
*
* @parameter expression="${linkoffline}"
* @parameter expression="${offlineLinks}"
*/
private String linkoffline;
private ArrayList offlineLinks;
/**
* Creates an HTML version of each source file (with line numbers) and adds links to them from the standard HTML documentation.
@ -805,14 +805,14 @@ public class JavadocReport
addArgIfNotEmpty( arguments, "-group", quotedArgument( group ), true );
addArgIfNotEmpty( arguments, "-header", quotedArgument( header ) );
addArgIfNotEmpty( arguments, "-helpfile", quotedPathArgument( helpfile ) );
if ( !isOffline )
{
addArgIfNotEmpty( arguments, "-link", quotedPathArgument( link ), true );
addArgIfNotEmpty( arguments, "-linkoffline", quotedPathArgument( linkoffline ), true );
addLinkArguments( arguments );
addLinkofflineArguments( arguments );
addArgIf( arguments, linksource, "-linksource", 1.4f );
}
addArgIf( arguments, nodeprecated, "-nodeprecated" );
addArgIf( arguments, nodeprecatedlist, "-nodeprecatedlist" );
addArgIf( arguments, nocomment, "-nocomment", 1.4f );
@ -1070,6 +1070,40 @@ public class JavadocReport
return value;
}
/**
* Convenience method to process offlineLink values as individual -linkoffline javadoc options
*
* @param arguments argument list
*/
private void addLinkofflineArguments( List arguments )
{
if ( offlineLinks != null )
{
for ( int i = 0; i < offlineLinks.size(); i++ )
{
OfflineLink offlineLink = (OfflineLink)offlineLinks.get(i);
addArgIfNotEmpty( arguments, "-linkoffline",
quotedPathArgument( offlineLink.getUrl() ) + " " + quotedPathArgument( offlineLink.getLocation().getAbsolutePath() ), true );
}
}
}
/**
* Convenience method to process link values as individual -link javadoc options
*
* @param arguments argument list
*/
private void addLinkArguments( List arguments )
{
if ( links != null )
{
for ( int i = 0; i < links.size(); i++ )
{
addArgIfNotEmpty( arguments, "-link", quotedPathArgument( (String)links.get(i) ), true );
}
}
}
/**
* Returns an input stream for reading the specified resource from the
* current class loader.

View File

@ -0,0 +1,45 @@
package org.apache.maven.plugin.javadoc;
import java.io.File;
/*
* Copyright 2004-2005 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.
*/
public class OfflineLink
{
private String url;
private File location;
public String getUrl()
{
return url;
}
public void setUrl( String url )
{
this.url = url;
}
public File getLocation()
{
return location;
}
public void setLocation( File location )
{
this.location = location;
}
}