diff --git a/src/it/projects/MJAVADOC-642/invoker.properties b/src/it/projects/MJAVADOC-642/invoker.properties
new file mode 100644
index 000000000..4c251c074
--- /dev/null
+++ b/src/it/projects/MJAVADOC-642/invoker.properties
@@ -0,0 +1,18 @@
+# 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
diff --git a/src/it/projects/MJAVADOC-642/pom.xml b/src/it/projects/MJAVADOC-642/pom.xml
new file mode 100644
index 000000000..a086f869f
--- /dev/null
+++ b/src/it/projects/MJAVADOC-642/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
+
+ true
+ 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 000000000..088c2b3c0
--- /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 000000000..05c877887
--- /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) offline = false") == 0
+assert log.count("[DEBUG] (f) offline = 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 000000000..0fe009670
--- /dev/null
+++ b/src/it/projects/MJAVADOC-642_cmdline/invoker.properties
@@ -0,0 +1,18 @@
+# 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
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 000000000..3297e5f63
--- /dev/null
+++ b/src/it/projects/MJAVADOC-642_cmdline/pom.xml
@@ -0,0 +1,52 @@
+
+
+
+ 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
+
+ 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 000000000..088c2b3c0
--- /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 000000000..05c877887
--- /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) offline = false") == 0
+assert log.count("[DEBUG] (f) offline = 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 5f8c30fa4..e812c17ff 100644
--- a/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
+++ b/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
@@ -333,10 +333,14 @@ public abstract class AbstractJavadocMojo extends AbstractMojo {
private MojoExecution mojo;
/**
- * Specify if the Javadoc should operate in offline mode.
+ * Specify if the Javadoc plugin should operate in offline mode. If maven is run in offline
+ * mode (using {@code -o} or {@code --offline} on the command line), this option has no effect
+ * and the plugin is always in offline mode.
+ *
+ * @since 3.6.0
*/
- @Parameter(defaultValue = "${settings.offline}", required = true, readonly = true)
- private boolean isOffline;
+ @Parameter(property = "maven.javadoc.offline", defaultValue = "false")
+ private boolean offline;
/**
* Specifies the Javadoc resources directory to be included in the Javadoc (i.e. package.html, images...).
@@ -1033,7 +1037,9 @@ public abstract class AbstractJavadocMojo extends AbstractMojo {
*
* Notes:
*
- *
only used if {@code isOffline} is set to false.
+ *
This option is ignored if the plugin is run in offline mode (using the {@code }
+ * setting or specifying {@code -o, --offline} or {@code -Dmaven.javadoc.offline=true} on the
+ * command line.
*
all given links should have a fetchable /package-list or /element-list
* (since Java 10). For instance:
*