Java 8 + Maven Javadoc plugin: Error fetching URL
Asked Answered
O

0

7

I am attempting to generate Javadoc that actually links to the Javadoc for my dependencies. I have tried various means to generate Javadoc which does not produce the fully qualified class names for references to classes from my dependencies. I wanted links to the Java doc with the simplified class names. However, even with Java API classnames, I get NO links and have fully qualified class names. I am working with Java 8. I have the following configuration:

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>2.10.2</version>
            <configuration>
                <reportOutputDirectory>${project.basedir}/target</reportOutputDirectory>
                <destDir>javadoc</destDir>
                <windowtitle>Epiphany</windowtitle>
                <doctitle>Epiphany</doctitle>
                <show>private</show>
                <detectLinks>false</detectLinks>
                <detectOfflineLinks>true</detectOfflineLinks>
                <linksource>true</linksource>
                <detectJavaApiLink>false</detectJavaApiLink>
                <additionalparam>-Xdoclint:none</additionalparam>
                <links>
                    <link>http://docs.oracle.com/javase/8/docs/api</link>
                </links>

            </configuration>
            <executions>
                <execution>
                    <goals>
                        <goal>javadoc</goal>
                        <goal>test-javadoc</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

I have the source set to Java 8 in my maven compiler configuration. I have tried using detectJavaApiLink set to true and leaving out the link to the Java 8 Javadoc, but Javadoc does not generate links to Java API classes and all references to them in my Javadoc are fully qualified class names.

I have tried setting detectJavaApiLink to false and using the above configuration with a specified URL(without and without a trailing slash) and I get the same result, along with this error:

[WARNING] javadoc: warning - Error fetching URL: http://docs.oracle.com/javase/8/docs/api

I have tried detecting links based on my declared dependencies, and I have tried setting it to false and then providing links to the Javadoc and I still get no links and all class names from classes in my dependencies are fully qualified. What the heck am I doing wrong? The package-list files are available at the URLs specified, so I don't get why Javadoc cannot access them or the Javadoc located there.

UPDATE:

Changed my version of the maven javadoc plugin to 2.10.3. Now, if I set detectJavaApiLink to true and remove the link for Java 8 javadoc, the javadoc generated properly links to Java API classes and used the simplified names.

However, I am still having problems with my 3rd party dependencies and linking to their Javadoc. If I set detectLinks to true, it fails to find the javadoc for any of them. If I set it to false and manually configure the location, I still get an error message saying it cannot fetch the URL:

[WARNING] javadoc: warning - Error fetching URL: https://selenium.googlecode.com/git/docs/api/java

My updated pom configuration for the maven javadoc plugin is below:

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>2.10.3</version>
        <configuration>
            <reportOutputDirectory>${project.basedir}/target</reportOutputDirectory>
            <destDir>javadoc</destDir>
            <windowtitle>Epiphany</windowtitle>
            <doctitle>Epiphany</doctitle>
            <show>private</show>
            <detectLinks>false</detectLinks>
            <detectOfflineLinks>true</detectOfflineLinks>
            <linksource>true</linksource>
            <additionalparam>-Xdoclint:none</additionalparam>
            <detectJavaApiLink>true</detectJavaApiLink>
            <links>
                <link>https://selenium.googlecode.com/git/docs/api/java</link>
            </links>
        </configuration>
        <executions>
            <execution>
                <goals>
                    <goal>javadoc</goal>
                    <goal>test-javadoc</goal>
                </goals>
            </execution>
        </executions>
    </plugin>

UPDATE 2:

Defect report filed with MJAVADOC:

https://issues.apache.org/jira/browse/MJAVADOC-427

Osugi answered 17/4, 2015 at 17:51 Comment(8)
Please check maven-javadoc-plugin version 2.10.3...Indistinguishable
I have updated to 2.10.3 and this solved my issues with the Java 8 API classes. It now links them and uses the simplfied name. I still cannot get links and simplified names for my 3rd party dependencies under any of the scenarios I tried -- detecting links automatically or manually configuring the links.Osugi
Can you create a sample project for which is not working and may be creating a jira issue issues.apache.org/jira/browse/MJAVADOC and attach the example to the jira issue.Indistinguishable
Will do. I will have to do this tomorrow morning.Osugi
I filed the defect report. Hopefully it gets resolved soon. I have a code review coming up and I hoped to have some nice, easy to read fully linked javadoc.Osugi
@Osugi - The way to get something fixed in a hurry in an open source project is to fix it yourself ... and contribute your fixes.Creel
@Stephen C - If I had time to get familiar enough with the source code for this tool, I'd give this a try, but unfortunately, I have a bit too much on my plate to try this one.Osugi
Could be related: issues.apache.org/jira/browse/MJAVADOC-393 (-link option values have their trailing slash removed; breaks javadoc 8)Sumptuous

© 2022 - 2024 — McMap. All rights reserved.