Author: aramirez
Date: Fri Mar 3 18:55:44 2006
New Revision: 383005
URL: http://svn.apache.org/viewcvs?rev=383005&view=rev
Log:
PR: MJAVADOC-46
Submitted By: Wendy Smoak
Reviewed By: Maria Odea Ching
- allowed -docletpath to be specified as docletArtifact
Added:
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/DocletArtifact.java
Modified:
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/JavadocReport.java
maven/plugins/trunk/maven-javadoc-plugin/src/site/apt/configuration.apt
Added:
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/DocletArtifact.java
URL:
http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/DocletArtifact.java?rev=383005&view=auto
==============================================================================
---
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/DocletArtifact.java
(added)
+++
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/DocletArtifact.java
Fri Mar 3 18:55:44 2006
@@ -0,0 +1,50 @@
+package org.apache.maven.plugin.javadoc;
+
+/*
+ * Copyright 2006 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 DocletArtifact {
+
+ private String groupId;
+ private String artifactId;
+ private String version;
+
+ public String getGroupId() {
+ return groupId;
+ }
+
+ public void setGroupId( String groupId ) {
+ this.groupId = groupId;
+ }
+
+ public String getArtifactId() {
+ return artifactId;
+ }
+
+ public void setArtifactId( String artifactId ) {
+ this.artifactId = artifactId;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion( String version ) {
+ this.version = version;
+ }
+
+}
Modified:
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/JavadocReport.java
URL:
http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/JavadocReport.java?rev=383005&r1=383004&r2=383005&view=diff
==============================================================================
---
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/JavadocReport.java
(original)
+++
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/JavadocReport.java
Fri Mar 3 18:55:44 2006
@@ -30,8 +30,14 @@
import org.apache.commons.lang.ClassUtils;
import org.apache.commons.lang.SystemUtils;
import org.apache.commons.lang.math.NumberUtils;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.factory.ArtifactFactory;
import org.apache.maven.artifact.DependencyResolutionRequiredException;
import org.apache.maven.artifact.handler.ArtifactHandler;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.resolver.ArtifactResolutionException;
+import org.apache.maven.artifact.resolver.ArtifactResolver;
+import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
import org.apache.maven.model.Model;
import org.apache.maven.plugin.javadoc.options.Group;
import org.apache.maven.plugin.javadoc.options.Tag;
@@ -148,6 +154,15 @@
private String docletPath;
/**
+ * Specifies the artifact containing the doclet starting class file
(specified with the -docletpath option).
+ * See <a
href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javadoc.html#docletpath">docletpath</a>.
+ *
+ * @parameter
+ */
+ //TODO: May need to allow multiple artifacts
+ private DocletArtifact docletArtifact;
+
+ /**
* Specifies the encoding name of the source files.
* See <a
href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javadoc.html#encoding">encoding</a>.
*
@@ -535,6 +550,19 @@
*/
private String windowtitle;
+ /** @component */
+ private ArtifactResolver resolver;
+
+ /** @component */
+ private ArtifactFactory factory;
+
+ /** @parameter expression="${localRepository}" */
+ private ArtifactRepository localRepository;
+
+ /** @parameter expression="${project.remoteArtifactRepositories}" */
+ private List remoteRepositories;
+
+
// ----------------------------------------------------------------------
//
// ----------------------------------------------------------------------
@@ -773,6 +801,20 @@
if ( !StringUtils.isEmpty( doclet ) )
{
addArgIfNotEmpty( arguments, "-doclet", quotedArgument( doclet ) );
+
+ if ( docletArtifact != null ) {
+ Artifact artifact = factory.createArtifact(
docletArtifact.getGroupId(),
+ docletArtifact.getArtifactId(),
docletArtifact.getVersion(), "compile", "jar" );
+ try {
+ resolver.resolve( artifact, remoteRepositories,
localRepository );
+ docletPath = artifact.getFile().getAbsolutePath();
+ } catch ( ArtifactResolutionException e ) {
+ throw new MavenReportException( "Unable to resolve
artifact.", e );
+ } catch (ArtifactNotFoundException e) {
+ throw new MavenReportException( "Unable to find
artifact.", e );
+ }
+ }
+
addArgIfNotEmpty( arguments, "-docletpath", quotedPathArgument(
docletPath ) );
}
addArgIfNotEmpty( arguments, "-encoding", quotedArgument( encoding ) );
Modified:
maven/plugins/trunk/maven-javadoc-plugin/src/site/apt/configuration.apt
URL:
http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-javadoc-plugin/src/site/apt/configuration.apt?rev=383005&r1=383004&r2=383005&view=diff
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/site/apt/configuration.apt
(original)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/site/apt/configuration.apt Fri
Mar 3 18:55:44 2006
@@ -31,7 +31,54 @@
</reporting>
...
</project>
--------------------
+------------------
+
+ To generate output from an alternate doclet in addition to the project
javadocs, add configuration
+ similar to the following to your POM:
+
+------------------
+<project>
+ ...
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <reportSets>
+ <reportSet>
+ <id>uml</id>
+ <configuration>
+ <doclet>gr.spinellis.umlgraph.doclet.UmlGraph</doclet>
+ <docletArtifact>
+ <groupId>umlgraph</groupId>
+ <artifactId>UMLGraph</artifactId>
+ <version>4.2-SNAPSHOT</version>
+ </docletArtifact>
+ <additionalparam>-views</additionalparam>
+ <destDir>target/uml</destDir>
+ <show>private</show>
+ </configuration>
+ <reports>
+ <report>javadoc</report>
+ </reports>
+ </reportSet>
+ <reportSet>
+ <id>html</id>
+ <configuration>
+ <show>private</show>
+ </configuration>
+ <reports>
+ <report>javadoc</report>
+ </reports>
+ </reportSet>
+ </reportSets>
+ </plugin>
+ ...
+ </plugins>
+ </reporting>
+ ...
+</project>
+------------------
The configuration within <reporting> is not used when javadoc is explicitly
invoked
via 'mvn javadoc:javadoc'. To configure explicit invocation, use the
<build> element instead: