diff --git a/src/it/projects/MJAVADOC-642/invoker.properties b/src/it/projects/MJAVADOC-642/invoker.properties
new file mode 100644
index 00000000..c30bd85d
--- /dev/null
+++ b/src/it/projects/MJAVADOC-642/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= package
+invoker.java.version = 9+
diff --git a/src/it/projects/MJAVADOC-642/pom.xml b/src/it/projects/MJAVADOC-642/pom.xml
new file mode 100644
index 00000000..b4163370
--- /dev/null
+++ b/src/it/projects/MJAVADOC-642/pom.xml
@@ -0,0 +1,54 @@
+
+
+
+ 4.0.0
+
+ org.apache.maven.plugins.javadoc.it
+ mjavadoc642
+ 1.0-SNAPSHOT
+ jar
+
+ https://issues.apache.org/jira/browse/MJAVADOC-642
+
+
+ UTF-8
+
+
+
+
+
+ maven-javadoc-plugin
+ @project.version@
+
+
+ javadoc
+
+ jar
+
+ package
+
+ true
+ ${project.build.targetJdk}
+ false
+ false
+ false
+ true
+
+
+
+
+
+
+
diff --git a/src/it/projects/MJAVADOC-642/src/main/java/mjavadoc642/Main.java b/src/it/projects/MJAVADOC-642/src/main/java/mjavadoc642/Main.java
new file mode 100644
index 00000000..088c2b3c
--- /dev/null
+++ b/src/it/projects/MJAVADOC-642/src/main/java/mjavadoc642/Main.java
@@ -0,0 +1,35 @@
+/*
+ * 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.
+ */
+
+package mjavadoc642;
+
+/**
+ * This is the main class.
+ */
+public final class Main {
+ /**
+ * This is the main method.
+ *
+ * @param args The arguments
+ * @throws Exception if something goes wrong
+ */
+ public static final void main(String ... args) throws Exception {
+ System.out.println("Hello, World!");
+ }
+}
diff --git a/src/it/projects/MJAVADOC-642/verify.groovy b/src/it/projects/MJAVADOC-642/verify.groovy
new file mode 100644
index 00000000..d581b79c
--- /dev/null
+++ b/src/it/projects/MJAVADOC-642/verify.groovy
@@ -0,0 +1,23 @@
+/*
+ * 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.
+ */
+
+def log = new File( basedir, 'build.log').text
+
+assert log.count("[DEBUG] (f) isOffline = false") == 0
+assert log.count("[DEBUG] (f) isOffline = true") == 1
diff --git a/src/it/projects/MJAVADOC-642_cmdline/invoker.properties b/src/it/projects/MJAVADOC-642_cmdline/invoker.properties
new file mode 100644
index 00000000..cb08591b
--- /dev/null
+++ b/src/it/projects/MJAVADOC-642_cmdline/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= -Dmaven.javadoc.offline=true package
+invoker.java.version = 9+
diff --git a/src/it/projects/MJAVADOC-642_cmdline/pom.xml b/src/it/projects/MJAVADOC-642_cmdline/pom.xml
new file mode 100644
index 00000000..d82e3aa3
--- /dev/null
+++ b/src/it/projects/MJAVADOC-642_cmdline/pom.xml
@@ -0,0 +1,53 @@
+
+
+
+ 4.0.0
+
+ org.apache.maven.plugins.javadoc.it
+ mjavadoc642
+ 1.0-SNAPSHOT
+ jar
+
+ https://issues.apache.org/jira/browse/MJAVADOC-642
+
+
+ UTF-8
+
+
+
+
+
+ maven-javadoc-plugin
+ @project.version@
+
+
+ javadoc
+
+ jar
+
+ package
+
+ ${project.build.targetJdk}
+ false
+ false
+ false
+ true
+
+
+
+
+
+
+
diff --git a/src/it/projects/MJAVADOC-642_cmdline/src/main/java/mjavadoc642/Main.java b/src/it/projects/MJAVADOC-642_cmdline/src/main/java/mjavadoc642/Main.java
new file mode 100644
index 00000000..088c2b3c
--- /dev/null
+++ b/src/it/projects/MJAVADOC-642_cmdline/src/main/java/mjavadoc642/Main.java
@@ -0,0 +1,35 @@
+/*
+ * 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.
+ */
+
+package mjavadoc642;
+
+/**
+ * This is the main class.
+ */
+public final class Main {
+ /**
+ * This is the main method.
+ *
+ * @param args The arguments
+ * @throws Exception if something goes wrong
+ */
+ public static final void main(String ... args) throws Exception {
+ System.out.println("Hello, World!");
+ }
+}
diff --git a/src/it/projects/MJAVADOC-642_cmdline/verify.groovy b/src/it/projects/MJAVADOC-642_cmdline/verify.groovy
new file mode 100644
index 00000000..d581b79c
--- /dev/null
+++ b/src/it/projects/MJAVADOC-642_cmdline/verify.groovy
@@ -0,0 +1,23 @@
+/*
+ * 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.
+ */
+
+def log = new File( basedir, 'build.log').text
+
+assert log.count("[DEBUG] (f) isOffline = false") == 0
+assert log.count("[DEBUG] (f) isOffline = true") == 1
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 b0d401c7..572096de 100644
--- a/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
+++ b/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
@@ -334,8 +334,10 @@ public abstract class AbstractJavadocMojo extends AbstractMojo {
/**
* Specify if the Javadoc should operate in offline mode.
+ *
+ * @since 3.5.1
*/
- @Parameter(defaultValue = "${settings.offline}", required = true, readonly = true)
+ @Parameter(name = "offline", alias = "isOffline", property = "maven.javadoc.offline", defaultValue = "false")
private boolean isOffline;
/**
@@ -1033,7 +1035,7 @@ public abstract class AbstractJavadocMojo extends AbstractMojo {
*
* Notes:
*
- * - only used if {@code isOffline} is set to
false
.
+ * - only used if the plugin is not run in offline mode.
* - all given links should have a fetchable
/package-list
or /element-list
* (since Java 10). For instance:
*
@@ -3781,7 +3783,7 @@ private void addLinkArguments(List arguments) throws MavenReportExceptio
continue;
}
- if (isOffline && !link.startsWith("file:")) {
+ if ((settings.isOffline() || isOffline) && !link.startsWith("file:")) {
continue;
}