This is an automated email from the ASF dual-hosted git repository. rfscholte pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/maven-javadoc-plugin.git
The following commit(s) were added to refs/heads/master by this push: new 69ec690 [MJAVADOC-495] links option ignored in offline mode, even for local links 69ec690 is described below commit 69ec690c0328229b7353f6eed8600aabe19ec9fa Author: rfscholte <rfscho...@apache.org> AuthorDate: Tue Dec 11 21:31:53 2018 +0100 [MJAVADOC-495] links option ignored in offline mode, even for local links --- .../invoker.properties | 19 ++++++++ .../MJAVADOC-495_offline-filescheme/package-list | 1 + .../MJAVADOC-495_offline-filescheme/pom.xml | 50 ++++++++++++++++++++++ .../src/main/java/foo/Bar.java | 23 ++++++++++ .../MJAVADOC-495_offline-filescheme/verify.groovy | 25 +++++++++++ .../maven/plugins/javadoc/AbstractJavadocMojo.java | 10 +++-- 6 files changed, 124 insertions(+), 4 deletions(-) diff --git a/src/it/projects/MJAVADOC-495_offline-filescheme/invoker.properties b/src/it/projects/MJAVADOC-495_offline-filescheme/invoker.properties new file mode 100644 index 0000000..660868e --- /dev/null +++ b/src/it/projects/MJAVADOC-495_offline-filescheme/invoker.properties @@ -0,0 +1,19 @@ +# 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. + +invoker.goals.1=clean javadoc:javadoc +invoker.goals.2=clean javadoc:javadoc -o diff --git a/src/it/projects/MJAVADOC-495_offline-filescheme/package-list b/src/it/projects/MJAVADOC-495_offline-filescheme/package-list new file mode 100644 index 0000000..6b0ba6f --- /dev/null +++ b/src/it/projects/MJAVADOC-495_offline-filescheme/package-list @@ -0,0 +1 @@ +com.baz \ No newline at end of file diff --git a/src/it/projects/MJAVADOC-495_offline-filescheme/pom.xml b/src/it/projects/MJAVADOC-495_offline-filescheme/pom.xml new file mode 100644 index 0000000..33e8d3a --- /dev/null +++ b/src/it/projects/MJAVADOC-495_offline-filescheme/pom.xml @@ -0,0 +1,50 @@ +<?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>mjavadoc-495</artifactId> + <version>1.0-SNAPSHOT</version> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> + + <build> + <pluginManagement> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-javadoc-plugin</artifactId> + <version>@project.version@</version> + <configuration> + <links> + <link>${project.baseUri}</link> + </links> + </configuration> + </plugin> + </plugins> + </pluginManagement> + </build> + +</project> diff --git a/src/it/projects/MJAVADOC-495_offline-filescheme/src/main/java/foo/Bar.java b/src/it/projects/MJAVADOC-495_offline-filescheme/src/main/java/foo/Bar.java new file mode 100644 index 0000000..05e463e --- /dev/null +++ b/src/it/projects/MJAVADOC-495_offline-filescheme/src/main/java/foo/Bar.java @@ -0,0 +1,23 @@ +package foo; + +/* + * 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. + */ + +public class Bar { +} diff --git a/src/it/projects/MJAVADOC-495_offline-filescheme/verify.groovy b/src/it/projects/MJAVADOC-495_offline-filescheme/verify.groovy new file mode 100644 index 0000000..ce90596 --- /dev/null +++ b/src/it/projects/MJAVADOC-495_offline-filescheme/verify.groovy @@ -0,0 +1,25 @@ +/* + * 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. + */ + +assert new File( basedir, 'target/site/apidocs/options').readLines() + .dropWhile{ it != '-link'} + .drop(1) + .first() + .startsWith( "'file:/" ) + diff --git a/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java b/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java index 4ff10ec..2cf572b 100644 --- a/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java +++ b/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java @@ -4051,6 +4051,11 @@ public abstract class AbstractJavadocMojo { continue; } + + if ( isOffline && !link.startsWith( "file:" ) ) + { + continue; + } while ( link.endsWith( "/" ) ) { @@ -4907,10 +4912,7 @@ public abstract class AbstractJavadocMojo addArgIf( arguments, keywords, "-keywords", SINCE_JAVADOC_1_4_2 ); - if ( !isOffline ) - { - addLinkArguments( arguments ); - } + addLinkArguments( arguments ); addLinkofflineArguments( arguments );