Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MJAVADOC-726] exclude velocity #243

Merged
merged 2 commits into from
Sep 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,13 @@ under the License.
<groupId>org.apache.maven.doxia</groupId>
<artifactId>doxia-site-renderer</artifactId>
<version>${doxia-sitetoolsVersion}</version>
<exclusions>
<exclusion>
<!-- MJAVADOC-726 -->
<groupId>org.apache.velocity</groupId>
<artifactId>velocity-tools</artifactId>
</exclusion>
</exclusions>
</dependency>

<!-- wagon -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ public abstract class AbstractJavadocMojo extends AbstractMojo {
private boolean detectOfflineLinks;

/**
* Detect the Java API link for the current build, i.e. <code>https://docs.oracle.com/javase/1.4.2/docs/api/</code>
* Detect the Java API link for the current build, e.g. <code>https://docs.oracle.com/javase/1.4.2/docs/api/</code>
* for Java source 1.4.
* <br/>
* By default, the goal detects the Javadoc API link depending the value of the <code>source</code>
Expand Down Expand Up @@ -3767,7 +3767,7 @@ private Set<OfflineLink> getLinkofflines() throws MavenReportException {
* If {@code detectLinks}, try to add javadoc apidocs according Maven conventions for all dependencies given
* in the project.
* <br/>
* According the Javadoc documentation, all defined link should have <code>${link}/package-list</code> fetchable.
* According the Javadoc documentation, all defined links should have <code>${link}/package-list</code> fetchable.
* <br/>
* <b>Note</b>: when a link is not fetchable:
* <ul>
Expand Down Expand Up @@ -3802,7 +3802,7 @@ private void addLinkArguments(List<String> arguments) throws MavenReportExceptio
}

/**
* Coppy all resources to the output directory
* Copy all resources to the output directory.
*
* @param javadocOutputDirectory not null
* @throws MavenReportException if any
Expand Down Expand Up @@ -5725,14 +5725,17 @@ private Set<String> followLinks(Set<String> links) {
try {
redirectLinks.add(JavadocUtil.getRedirectUrl(new URI(link).toURL(), settings)
.toString());
} catch (Exception e) {
} catch (IOException e) {
// only print in debug, it should have been logged already in warn/error because link isn't valid
getLog().debug("Could not follow " + link + ". Reason: " + e.getMessage());

// Even when link produces error it should be kept in the set because the error might be caused by
// incomplete redirect configuration on the server side.
// This partially restores the previous behaviour before fix for MJAVADOC-427
redirectLinks.add(link);
} catch (URISyntaxException | IllegalArgumentException e) {
// only print in debug, it should have been logged already in warn/error because link isn't valid
getLog().debug("Could not follow " + link + ". Reason: " + e.getMessage());
}
}
return redirectLinks;
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/org/apache/maven/plugins/javadoc/JavadocUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -1218,7 +1218,7 @@ static <T> List<T> toList(T single, T[] multiple) {
return result;
}

// TODO: move to plexus-utils or use something appropriate from there
// TODO: deprecate in favor of Path.relativize
public static String toRelative(File basedir, String absolutePath) {
String relative;

Expand Down Expand Up @@ -1259,13 +1259,13 @@ public static boolean isEmpty(final Collection<?> collection) {
}

/**
* Execute an Http request at the given URL, follows redirects, and returns the last redirect locations. For URLs
* Execute an HTTP request to the given URL, follow redirects, and return the last redirect location. For URLs
* that aren't http/https, this does nothing and simply returns the given URL unchanged.
*
* @param url URL.
* @param settings Maven settings.
* @return Last redirect location.
* @throws IOException if there was an error during the Http request.
* @param url URL
* @param settings Maven settings
* @return final URL after all redirects have been followed
* @throws IOException if there was an error during the HTTP request
*/
protected static URL getRedirectUrl(URL url, Settings settings) throws IOException {
String protocol = url.getProtocol();
Expand Down