diff --git a/maven-plugins/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/JavadocReport.java b/maven-plugins/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/JavadocReport.java index 28f6cf9a54..3a4a06ad51 100644 --- a/maven-plugins/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/JavadocReport.java +++ b/maven-plugins/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/JavadocReport.java @@ -80,7 +80,7 @@ public class JavadocReport // ---------------------------------------------------------------------- // Mojo Parameters // ---------------------------------------------------------------------- - + /** * @parameter default-value="${settings.offline}" * @required @@ -360,18 +360,18 @@ public class JavadocReport * See link. * 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 linkoffline. * 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. diff --git a/maven-plugins/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/OfflineLink.java b/maven-plugins/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/OfflineLink.java new file mode 100644 index 0000000000..bee32afc23 --- /dev/null +++ b/maven-plugins/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/OfflineLink.java @@ -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; + } +}