Skip to content

Commit

Permalink
[MJAVADOC-726] exclude velocity (#243)
Browse files Browse the repository at this point in the history
* [MJAVADOC-726] exclude velocity
  • Loading branch information
elharo authored Sep 24, 2023
1 parent d1ef192 commit 05b12e8
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
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

0 comments on commit 05b12e8

Please sign in to comment.