You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by vs...@apache.org on 2009/09/12 17:34:45 UTC
svn commit: r814171 - in /maven/plugins/trunk/maven-javadoc-plugin: ./
src/it/MJAVADOC-262/ src/it/MJAVADOC-262/src/ src/it/MJAVADOC-262/src/main/
src/it/MJAVADOC-262/src/main/java/ src/it/MJAVADOC-262/src/main/java/com/
src/it/MJAVADOC-262/src/main/ja...
Author: vsiveton
Date: Sat Sep 12 15:34:43 2009
New Revision: 814171
URL: http://svn.apache.org/viewvc?rev=814171&view=rev
Log:
MJAVADOC-262: Parameters like sourcepath depend on system path separator (colon/semicolon)
o be platform independent for path parameters (sourcepath, docletPath, extdirs, sourcepath, tagletpath, bootclasspath)
o added org.apache.tools.ant.PathTokenizer class from ASF Ant project
o updated javadoc
o added IT
Added:
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-262/
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-262/goals.txt (with props)
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-262/pom.xml (with props)
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-262/src/
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-262/src/main/
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-262/src/main/java/
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-262/src/main/java/com/
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-262/src/main/java/com/mycompany/
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-262/src/main/java/com/mycompany/myapp/
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-262/src/main/java/com/mycompany/myapp/App.java (with props)
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-262/src/main/javadoc/
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-262/src/main/javadoc/com/
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-262/src/main/javadoc/com/mycompany/
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-262/src/main/javadoc/com/mycompany/myapp/
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-262/src/main/javadoc/com/mycompany/myapp/doc-files/
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-262/src/main/javadoc/com/mycompany/myapp/doc-files/maven-feather.png (with props)
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-262/src/main/javadoc/stylesheet.css (with props)
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-262/src/test/
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-262/src/test/java/
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-262/src/test/java/com/
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-262/src/test/java/com/mycompany/
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-262/src/test/java/com/mycompany/myapp/
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-262/src/test/java/com/mycompany/myapp/AppTest.java (with props)
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-262/verify.bsh
Modified:
maven/plugins/trunk/maven-javadoc-plugin/pom.xml
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/JavadocUtil.java
maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugin/javadoc/JavadocUtilTest.java
Modified: maven/plugins/trunk/maven-javadoc-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/pom.xml?rev=814171&r1=814170&r2=814171&view=diff
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-javadoc-plugin/pom.xml Sat Sep 12 15:34:43 2009
@@ -371,6 +371,7 @@
<pomInclude>**/MJAVADOC-181/pom.xml</pomInclude>
<pomInclude>**/MJAVADOC-257/pom.xml</pomInclude>
<pomInclude>**/MJAVADOC-259/pom.xml</pomInclude>
+ <pomInclude>**/MJAVADOC-262/pom.xml</pomInclude>
</pomIncludes>
<postBuildHookScript>verify</postBuildHookScript>
<localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
Added: maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-262/goals.txt
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-262/goals.txt?rev=814171&view=auto
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-262/goals.txt (added)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-262/goals.txt Sat Sep 12 15:34:43 2009
@@ -0,0 +1 @@
+clean javadoc:javadoc
\ No newline at end of file
Propchange: maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-262/goals.txt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-262/goals.txt
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-262/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-262/pom.xml?rev=814171&view=auto
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-262/pom.xml (added)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-262/pom.xml Sat Sep 12 15:34:43 2009
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.maven.plugins.maven-javadoc-plugin.it</groupId>
+ <artifactId>myapp</artifactId>
+ <packaging>jar</packaging>
+ <version>1.0-SNAPSHOT</version>
+ <name>myapp</name>
+ <url>http://maven.apache.org</url>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>@pom.version@</version>
+ <configuration>
+ <sourcepath>${basedir}/src/main/java${wrongPathSeparator}${basedir}/src/test/java${wrongPathSeparator}${basedir}/src/main/javadoc</sourcepath>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>mac</id>
+ <activation>
+ <os>
+ <family>macosx</family>
+ </os>
+ </activation>
+ <properties>
+ <wrongPathSeparator>;</wrongPathSeparator>
+ </properties>
+ </profile>
+ <profile>
+ <id>unix</id>
+ <activation>
+ <os>
+ <family>linux</family>
+ </os>
+ </activation>
+ <properties>
+ <wrongPathSeparator>;</wrongPathSeparator>
+ </properties>
+ </profile>
+ <profile>
+ <id>windows</id>
+ <activation>
+ <os>
+ <family>windows</family>
+ </os>
+ </activation>
+ <properties>
+ <wrongPathSeparator>:</wrongPathSeparator>
+ </properties>
+ </profile>
+ </profiles>
+</project>
Propchange: maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-262/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-262/pom.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-262/src/main/java/com/mycompany/myapp/App.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-262/src/main/java/com/mycompany/myapp/App.java?rev=814171&view=auto
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-262/src/main/java/com/mycompany/myapp/App.java (added)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-262/src/main/java/com/mycompany/myapp/App.java Sat Sep 12 15:34:43 2009
@@ -0,0 +1,20 @@
+package com.mycompany.myapp;
+
+/**
+ * Hello world!
+ *
+ * <img src="doc-files/maven-feather.png" alt="Maven"/>
+ */
+public class App
+{
+ public static void main( String[] args )
+ {
+ System.out.println( "Hello World!" );
+ }
+
+
+ private static void main2()
+ {
+ System.out.println( "Hello World!" );
+ }
+}
Propchange: maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-262/src/main/java/com/mycompany/myapp/App.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-262/src/main/java/com/mycompany/myapp/App.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-262/src/main/javadoc/com/mycompany/myapp/doc-files/maven-feather.png
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-262/src/main/javadoc/com/mycompany/myapp/doc-files/maven-feather.png?rev=814171&view=auto
==============================================================================
Binary file - no diff available.
Propchange: maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-262/src/main/javadoc/com/mycompany/myapp/doc-files/maven-feather.png
------------------------------------------------------------------------------
svn:mime-type = image/png
Added: maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-262/src/main/javadoc/stylesheet.css
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-262/src/main/javadoc/stylesheet.css?rev=814171&view=auto
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-262/src/main/javadoc/stylesheet.css (added)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-262/src/main/javadoc/stylesheet.css Sat Sep 12 15:34:43 2009
@@ -0,0 +1,89 @@
+/* I don't know why these two class declarations are needed but they are */
+body {
+ background: #f8f4e8 url( resources/bg.jpg );
+ color: #4b2500;
+ font-family: serif;
+}
+
+.TableRowColor,
+.NavBarCell1 {
+ background: inherit
+}
+
+h1, h2, h3 {
+ background: rgba(255,239,0,0.41) url( resources/bg-dark.jpg );
+ padding: 2px;
+}
+
+.NavBarCell1Rev,
+.TableHeadingColor {
+ background: rgba(255,0,0,0.16) url( resources/bg-dark.jpg );
+ padding: 2px;
+}
+
+
+h4, h5,
+h3 + pre,
+.copyright,
+.NavBarCell2,
+.NavBarCell3,
+.TableSubHeadingColor {
+ background: rgba(247,248,255,0.89) url( resources/bg-light.jpg );
+ font-variant: normal;
+}
+
+.note {
+ background: #d1dcf2 url( resources/bg-beta.jpg );
+ font: italic 100% sans-serif;
+}
+
+.note {
+ margin-top: 10px;
+}
+
+table {
+ border-style: none;
+}
+
+tr.TableRowColor,
+tr.TableRowColor td,
+tr.TableRowColor th {
+ border-left-style: none;
+ vertical-align: baseline;
+ border-right-style: none;
+ border-color: #ba6009;
+ border-width: thin;
+ border-style: none;
+ border-bottom-style: solid;
+}
+
+tr.TableRowColor td:first-child {
+ border-right-style: solid;
+}
+
+hr {
+ border-color: transparent;
+ background-color: transparent;
+ border-style: solid;
+}
+
+.new {
+ background: #ffff88 url( resources/bg-highlight.jpg );
+}
+
+h3 {
+ padding: 5px;
+}
+h3 + pre {
+ border: 1px #439417;
+ padding: 5px;
+}
+
+.example {
+ padding-left: 4em;
+}
+
+p.copyright {
+ font-style: italic;
+ text-align: right;
+}
Propchange: maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-262/src/main/javadoc/stylesheet.css
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-262/src/main/javadoc/stylesheet.css
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-262/src/test/java/com/mycompany/myapp/AppTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-262/src/test/java/com/mycompany/myapp/AppTest.java?rev=814171&view=auto
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-262/src/test/java/com/mycompany/myapp/AppTest.java (added)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-262/src/test/java/com/mycompany/myapp/AppTest.java Sat Sep 12 15:34:43 2009
@@ -0,0 +1,38 @@
+package com.mycompany.myapp;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+ * Unit test for simple App.
+ */
+public class AppTest
+ extends TestCase
+{
+ /**
+ * Create the test case
+ *
+ * @param testName name of the test case
+ */
+ public AppTest( String testName )
+ {
+ super( testName );
+ }
+
+ /**
+ * @return the suite of tests being tested
+ */
+ public static Test suite()
+ {
+ return new TestSuite( AppTest.class );
+ }
+
+ /**
+ * Rigourous Test :-)
+ */
+ public void testApp()
+ {
+ assertTrue( true );
+ }
+}
Propchange: maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-262/src/test/java/com/mycompany/myapp/AppTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-262/src/test/java/com/mycompany/myapp/AppTest.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-262/verify.bsh
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-262/verify.bsh?rev=814171&view=auto
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-262/verify.bsh (added)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-262/verify.bsh Sat Sep 12 15:34:43 2009
@@ -0,0 +1,41 @@
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+
+import java.io.*;
+
+boolean result = true;
+
+try
+{
+ // Generated files checks
+ File apidocs = new File( basedir, "target/site/apidocs" );
+ if ( !apidocs.isDirectory() )
+ {
+ System.err.println( apidocs.getAbsolutePath() + " dir is missing or a directory." );
+ return false;
+ }
+}
+catch( RuntimeException e )
+{
+ e.printStackTrace();
+ return false;
+}
+
+return result;
Modified: maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java?rev=814171&r1=814170&r2=814171&view=diff
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java (original)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java Sat Sep 12 15:34:43 2009
@@ -135,7 +135,7 @@
*
* @since 2.6
*/
- public static final Properties DEFAULT_JAVA_API_LINKS = new Properties();
+ public static final Properties DEFAULT_JAVA_API_LINKS = new Properties();
/** The Javadoc script file name when <code>debug</code> parameter is on, i.e. javadoc.bat or javadoc.sh */
protected static final String DEBUG_JAVADOC_SCRIPT_NAME =
@@ -520,7 +520,8 @@
// ----------------------------------------------------------------------
/**
- * Specifies the paths where the boot classes reside.
+ * Specifies the paths where the boot classes reside. The <code>bootclasspath</code> can contain multiple paths
+ * by separating them with a colon (<code>:</code>) or a semi-colon (<code>;</code>).
* <br/>
* See <a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javadoc.html#bootclasspath">bootclasspath</a>.
* <br/>
@@ -624,8 +625,8 @@
/**
* Specifies the path to the doclet starting class file (specified with the <code>-doclet</code> option) and
- * any jar files it depends on. The docletPath can contain multiple paths by separating them with a colon
- * (<code>:</code>) on Solaris and a semi-colon (<code>;</code>) on Windows.
+ * any jar files it depends on. The <code>docletPath</code> can contain multiple paths by separating them with
+ * a colon (<code>:</code>) or a semi-colon (<code>;</code>).
* <br/>
* See <a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javadoc.html#docletpath">docletpath</a>.
*
@@ -661,8 +662,8 @@
private String excludePackageNames;
/**
- * Specifies the directories where extension classes reside. Separate directories in dirlist with a colon
- * (<code>:</code>) on Solaris and a semi-colon (<code>;</code>) on Windows.
+ * Specifies the directories where extension classes reside. Separate directories in <code>extdirs</code> with a
+ * colon (<code>:</code>) or a semi-colon (<code>;</code>).
* <br/>
* See <a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javadoc.html#extdirs">extdirs</a>.
*
@@ -794,8 +795,8 @@
private String source;
/**
- * Specifies the source paths where the subpackages are located. The paths are separated with a colon
- * (<code>:</code>) on Solaris and a semi-colon (<code>;</code>) on Windows.
+ * Specifies the source paths where the subpackages are located. The <code>sourcepath</code> can contain
+ * multiple paths by separating them with a colon (<code>:</code>) or a semi-colon (<code>;</code>).
* <br/>
* See <a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javadoc.html#sourcepath">sourcepath</a>.
*
@@ -1144,7 +1145,12 @@
/**
* Omits qualifying package name from ahead of class names in output.
- * <br/>
+ * Example:
+ * <pre>
+ * <noqualifier>all</noqualifier>
+ * or
+ * <noqualifier>packagename1:packagename2</noqualifier>
+ * </pre>
* See <a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javadoc.html#noqualifier">noqualifier</a>.
* <br/>
* Since <a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/javadoc/whatsnew-1.4.html#summary">Java 1.4</a>.
@@ -1401,9 +1407,8 @@
private TagletArtifact[] tagletArtifacts;
/**
- * Specifies the search paths for finding taglet class files (.class). The tagletPath can contain
- * multiple paths by separating them with a colon (<code>:</code>) on Solaris and a semi-colon (<code>;</code>)
- * on Windows.
+ * Specifies the search paths for finding taglet class files (.class). The <code>tagletpath</code> can contain
+ * multiple paths by separating them with a colon (<code>:</code>) or a semi-colon (<code>;</code>).
* <br/>
* See <a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javadoc.html#tagletpath">tagletpath</a>.
* <br/>
@@ -1936,7 +1941,7 @@
}
else
{
- sourcePaths = new ArrayList( Arrays.asList( sourcepath.split( "[;]" ) ) );
+ sourcePaths = new ArrayList( Arrays.asList( JavadocUtil.splitPath( sourcepath ) ) );
sourcePaths = JavadocUtil.pruneDirs( project, sourcePaths );
if ( getJavadocDirectory() != null )
{
@@ -2026,8 +2031,10 @@
/**
* Method to format the specified source paths that will be accepted by the javadoc tool.
*
- * @param sourcePaths the list of paths to the source files that will be included in the javadoc
- * @return a String that contains the formatted source path argument
+ * @param sourcePaths the list of paths to the source files that will be included in the javadoc.
+ * @return a String that contains the formatted source path argument, separated by the System pathSeparator
+ * string (colon (<code>:</code>) on Solaris or semi-colon (<code>;</code>) on Windows).
+ * @see File#pathSeparator
*/
private String getSourcePath( List sourcePaths )
{
@@ -2068,8 +2075,10 @@
* Method that sets the classpath elements that will be specified in the javadoc <code>-classpath</code>
* parameter.
*
- * @return a String that contains the concatenated classpath elements
- * @throws MavenReportException if any
+ * @return a String that contains the concatenated classpath elements, separated by the System pathSeparator
+ * string (colon (<code>:</code>) on Solaris or semi-colon (<code>;</code>) on Windows).
+ * @throws MavenReportException if any.
+ * @see File#pathSeparator
*/
private String getClasspath()
throws MavenReportException
@@ -2390,9 +2399,10 @@
/**
* Method to get the path of the bootclass artifacts used in the <code>-bootclasspath</code> option.
*
- * @return the path to jar file that contains taglet class file separated with a colon (<code>:</code>)
- * on Solaris and a semi-colon (<code>;</code>) on Windows
+ * @return a string that contains bootclass path, separated by the System pathSeparator string
+ * (colon (<code>:</code>) on Solaris or semi-colon (<code>;</code>) on Windows).
* @throws MavenReportException if any
+ * @see File#pathSeparator
*/
private String getBootclassPath()
throws MavenReportException
@@ -2421,7 +2431,7 @@
if ( StringUtils.isNotEmpty( bootclasspath ) )
{
- path.append( bootclasspath );
+ path.append( JavadocUtil.unifyPathSeparator( bootclasspath ) );
}
return path.toString();
@@ -2434,9 +2444,10 @@
* takes precedence over doclectArtifacts. docletPath is always appended to any result path
* definition.
*
- * @return the path to jar file that contains doclet class file separated with a colon (<code>:</code>)
- * on Solaris and a semi-colon (<code>;</code>) on Windows
+ * @return a string that contains doclet path, separated by the System pathSeparator string
+ * (colon (<code>:</code>) on Solaris or semi-colon (<code>;</code>) on Windows).
* @throws MavenReportException if any
+ * @see File#pathSeparator
*/
private String getDocletPath()
throws MavenReportException
@@ -2466,7 +2477,7 @@
if ( !StringUtils.isEmpty( docletPath ) )
{
- path.append( docletPath );
+ path.append( JavadocUtil.unifyPathSeparator( docletPath ) );
}
if ( StringUtils.isEmpty( path.toString() ) && getLog().isWarnEnabled() )
@@ -2501,9 +2512,10 @@
/**
* Method to get the path of the taglet artifacts used in the <code>-tagletpath</code> option.
*
- * @return the path to jar file that contains taglet class file separated with a colon (<code>:</code>)
- * on Solaris and a semi-colon (<code>;</code>) on Windows
+ * @return a string that contains taglet path, separated by the System pathSeparator string
+ * (colon (<code>:</code>) on Solaris or semi-colon (<code>;</code>) on Windows).
* @throws MavenReportException if any
+ * @see File#pathSeparator
*/
private String getTagletPath()
throws MavenReportException
@@ -2572,7 +2584,7 @@
if ( StringUtils.isNotEmpty( tagletpath ) )
{
- path.append( tagletpath );
+ path.append( JavadocUtil.unifyPathSeparator( tagletpath ) );
}
return path.toString();
@@ -3822,7 +3834,7 @@
addArgIfNotEmpty( arguments, "-exclude", getExcludedPackages( sourcePaths ), SINCE_JAVADOC_1_4 );
- addArgIfNotEmpty( arguments, "-extdirs", JavadocUtil.quotedPathArgument( extdirs ) );
+ addArgIfNotEmpty( arguments, "-extdirs", JavadocUtil.quotedPathArgument( JavadocUtil.unifyPathSeparator( extdirs ) ) );
if ( ( getOverview() != null ) && ( getOverview().exists() ) )
{
Modified: maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/JavadocUtil.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/JavadocUtil.java?rev=814171&r1=814170&r2=814171&view=diff
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/JavadocUtil.java (original)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/JavadocUtil.java Sat Sep 12 15:34:43 2009
@@ -38,6 +38,7 @@
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
+import java.util.NoSuchElementException;
import java.util.Properties;
import java.util.Set;
import java.util.StringTokenizer;
@@ -68,6 +69,7 @@
import org.apache.maven.shared.invoker.PrintStreamHandler;
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.IOUtil;
+import org.codehaus.plexus.util.Os;
import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.util.cli.CommandLineException;
import org.codehaus.plexus.util.cli.CommandLineUtils;
@@ -1103,6 +1105,64 @@
}
}
+ /**
+ * Split the given path with colon and semi-colon, to support Solaris and Windows path.
+ * Examples:
+ * <pre>
+ * splitPath( "/home:/tmp" ) = ["/home", "/tmp"]
+ * splitPath( "/home;/tmp" ) = ["/home", "/tmp"]
+ * splitPath( "C:/home:C:/tmp" ) = ["C:/home", "C:/tmp"]
+ * splitPath( "C:/home;C:/tmp" ) = ["C:/home", "C:/tmp"]
+ * </pre>
+ *
+ * @param path which can contain multiple paths separated with a colon (<code>:</code>) or a
+ * semi-colon (<code>;</code>), plateform independent. Could be null.
+ * @return the path splitted by colon or semi-colon or <code>null</code> if path was <code>null</code>.
+ * @since 2.6.1
+ */
+ protected static String[] splitPath( final String path )
+ {
+ if ( path == null )
+ {
+ return null;
+ }
+
+ List subpaths = new ArrayList();
+ PathTokenizer pathTokenizer = new PathTokenizer( path );
+ while ( pathTokenizer.hasMoreTokens() )
+ {
+ subpaths.add( pathTokenizer.nextToken() );
+ }
+
+ return (String[]) subpaths.toArray( new String[0] );
+ }
+
+ /**
+ * Unify the given path with the current System path separator, to be plateform independent.
+ * Examples:
+ * <pre>
+ * unifyPathSeparator( "/home:/tmp" ) = "/home:/tmp" (Solaris box)
+ * unifyPathSeparator( "/home:/tmp" ) = "/home;/tmp" (Windows box)
+ * </pre>
+ *
+ * @param path which can contain multiple paths by separating them with a colon (<code>:</code>) or a
+ * semi-colon (<code>;</code>), plateform independent. Could be null.
+ * @return the same path but separated with the current System path separator or <code>null</code> if path was
+ * <code>null</code>.
+ * @since 2.6.1
+ * @see #splitPath(String)
+ * @see File#pathSeparator
+ */
+ protected static String unifyPathSeparator( final String path )
+ {
+ if ( path == null )
+ {
+ return null;
+ }
+
+ return StringUtils.join( splitPath( path ), File.pathSeparator );
+ }
+
// ----------------------------------------------------------------------
// private methods
// ----------------------------------------------------------------------
@@ -1372,4 +1432,174 @@
return javaOpts;
}
+
+ /**
+ * A Path tokenizer takes a path and returns the components that make up
+ * that path.
+ *
+ * The path can use path separators of either ':' or ';' and file separators
+ * of either '/' or '\'.
+ *
+ * @version revision 439418 taken on 2009-09-12 from Ant Project
+ * (see http://svn.apache.org/repos/asf/ant/core/trunk/src/main/org/apache/tools/ant/PathTokenizer.java)
+ */
+ private static class PathTokenizer
+ {
+ /**
+ * A tokenizer to break the string up based on the ':' or ';' separators.
+ */
+ private StringTokenizer tokenizer;
+
+ /**
+ * A String which stores any path components which have been read ahead
+ * due to DOS filesystem compensation.
+ */
+ private String lookahead = null;
+
+ /**
+ * A boolean that determines if we are running on Novell NetWare, which
+ * exhibits slightly different path name characteristics (multi-character
+ * volume / drive names)
+ */
+ private boolean onNetWare = Os.isFamily( "netware" );
+
+ /**
+ * Flag to indicate whether or not we are running on a platform with a
+ * DOS style filesystem
+ */
+ private boolean dosStyleFilesystem;
+
+ /**
+ * Constructs a path tokenizer for the specified path.
+ *
+ * @param path The path to tokenize. Must not be <code>null</code>.
+ */
+ public PathTokenizer( String path )
+ {
+ if ( onNetWare )
+ {
+ // For NetWare, use the boolean=true mode, so we can use delimiter
+ // information to make a better decision later.
+ tokenizer = new StringTokenizer( path, ":;", true );
+ }
+ else
+ {
+ // on Windows and Unix, we can ignore delimiters and still have
+ // enough information to tokenize correctly.
+ tokenizer = new StringTokenizer( path, ":;", false );
+ }
+ dosStyleFilesystem = File.pathSeparatorChar == ';';
+ }
+
+ /**
+ * Tests if there are more path elements available from this tokenizer's
+ * path. If this method returns <code>true</code>, then a subsequent call
+ * to nextToken will successfully return a token.
+ *
+ * @return <code>true</code> if and only if there is at least one token
+ * in the string after the current position; <code>false</code> otherwise.
+ */
+ public boolean hasMoreTokens()
+ {
+ if ( lookahead != null )
+ {
+ return true;
+ }
+
+ return tokenizer.hasMoreTokens();
+ }
+
+ /**
+ * Returns the next path element from this tokenizer.
+ *
+ * @return the next path element from this tokenizer.
+ *
+ * @exception NoSuchElementException if there are no more elements in this
+ * tokenizer's path.
+ */
+ public String nextToken()
+ throws NoSuchElementException
+ {
+ String token = null;
+ if ( lookahead != null )
+ {
+ token = lookahead;
+ lookahead = null;
+ }
+ else
+ {
+ token = tokenizer.nextToken().trim();
+ }
+
+ if ( !onNetWare )
+ {
+ if ( token.length() == 1 && Character.isLetter( token.charAt( 0 ) ) && dosStyleFilesystem
+ && tokenizer.hasMoreTokens() )
+ {
+ // we are on a dos style system so this path could be a drive
+ // spec. We look at the next token
+ String nextToken = tokenizer.nextToken().trim();
+ if ( nextToken.startsWith( "\\" ) || nextToken.startsWith( "/" ) )
+ {
+ // we know we are on a DOS style platform and the next path
+ // starts with a slash or backslash, so we know this is a
+ // drive spec
+ token += ":" + nextToken;
+ }
+ else
+ {
+ // store the token just read for next time
+ lookahead = nextToken;
+ }
+ }
+ }
+ else
+ {
+ // we are on NetWare, tokenizing is handled a little differently,
+ // due to the fact that NetWare has multiple-character volume names.
+ if ( token.equals( File.pathSeparator ) || token.equals( ":" ) )
+ {
+ // ignore ";" and get the next token
+ token = tokenizer.nextToken().trim();
+ }
+
+ if ( tokenizer.hasMoreTokens() )
+ {
+ // this path could be a drive spec, so look at the next token
+ String nextToken = tokenizer.nextToken().trim();
+
+ // make sure we aren't going to get the path separator next
+ if ( !nextToken.equals( File.pathSeparator ) )
+ {
+ if ( nextToken.equals( ":" ) )
+ {
+ if ( !token.startsWith( "/" ) && !token.startsWith( "\\" ) && !token.startsWith( "." )
+ && !token.startsWith( ".." ) )
+ {
+ // it indeed is a drive spec, get the next bit
+ String oneMore = tokenizer.nextToken().trim();
+ if ( !oneMore.equals( File.pathSeparator ) )
+ {
+ token += ":" + oneMore;
+ }
+ else
+ {
+ token += ":";
+ lookahead = oneMore;
+ }
+ }
+ // implicit else: ignore the ':' since we have either a
+ // UNIX or a relative path
+ }
+ else
+ {
+ // store the token just read for next time
+ lookahead = nextToken;
+ }
+ }
+ }
+ }
+ return token;
+ }
+ }
}
Modified: maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugin/javadoc/JavadocUtilTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugin/javadoc/JavadocUtilTest.java?rev=814171&r1=814170&r2=814171&view=diff
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugin/javadoc/JavadocUtilTest.java (original)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugin/javadoc/JavadocUtilTest.java Sat Sep 12 15:34:43 2009
@@ -520,7 +520,7 @@
}
/**
- * Method to test copyJavadocResources()
+ * Method to test pruneDirs()
*
* @throws Exception if any
*/
@@ -539,6 +539,40 @@
}
/**
+ * Method to test unifyPathSeparator()
+ *
+ * @throws Exception if any
+ */
+ public void testUnifyPathSeparator()
+ throws Exception
+ {
+ assertEquals( null, JavadocUtil.unifyPathSeparator( null ) );
+
+ final String ps = File.pathSeparator;
+
+ // Windows
+ String path1 = "C:\\maven-javadoc-plugin\\src\\main\\java";
+ String path2 = "C:\\maven-javadoc-plugin\\src\\main\\javadoc";
+ assertEquals( path1 + ps + path2, JavadocUtil.unifyPathSeparator( path1 + ";" + path2 ) );
+ assertEquals( path1 + ps + path2, JavadocUtil.unifyPathSeparator( path1 + ":" + path2 ) );
+
+ path1 = "C:/maven-javadoc-plugin/src/main/java";
+ path2 = "C:/maven-javadoc-plugin/src/main/javadoc";
+ assertEquals( path1 + ps + path2, JavadocUtil.unifyPathSeparator( path1 + ";" + path2 ) );
+ assertEquals( path1 + ps + path2, JavadocUtil.unifyPathSeparator( path1 + ":" + path2 ) );
+ assertEquals( path1 + ps + path2 + ps + path1 + ps + path2, JavadocUtil.unifyPathSeparator( path1 + ";"
+ + path2 + ";" + path1 + ":" + path2 ) );
+
+ // Unix
+ path1 = "/tmp/maven-javadoc-plugin/src/main/java";
+ path2 = "/tmp/maven-javadoc-plugin/src/main/javadoc";
+ assertEquals( path1 + ps + path2, JavadocUtil.unifyPathSeparator( path1 + ";" + path2 ) );
+ assertEquals( path1 + ps + path2, JavadocUtil.unifyPathSeparator( path1 + ":" + path2 ) );
+ assertEquals( path1 + ps + path2 + ps + path1 + ps + path2, JavadocUtil.unifyPathSeparator( path1 + ";"
+ + path2 + ":" + path1 + ":" + path2 ) );
+ }
+
+ /**
* @param settings could be null
* @param logger could be null
* @param websiteUrl not null