From 31d86f6c2111a3439fe8d1a251ee250b1145685c Mon Sep 17 00:00:00 2001 From: Jack Date: Mon, 18 Aug 2025 15:05:19 +0100 Subject: [PATCH 1/3] Fix `package {...} does not exist` in `legacyMode` _Partially_ reverts change in https://github.com/apache/maven-javadoc-plugin/pull/1217, specifically: > Do not use --source-path in legacy mode as not to suck any of those module-info.java files back This is required to ensure correct package resolution on projects that mix modular & non-module Java code. --- .../org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 0e7d29f4d..3ca716711 100644 --- a/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java +++ b/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java @@ -4606,7 +4606,7 @@ private void addJavadocOptions( } if (moduleSourceDir == null) { - if (!disableSourcepathUsage && !legacyMode) { + if (!disableSourcepathUsage) { addArgIfNotEmpty( arguments, "-sourcepath", From e1a74738a2fbef8e191e31e580452deb51e8c918 Mon Sep 17 00:00:00 2001 From: Jack Date: Mon, 25 Aug 2025 23:37:50 +0100 Subject: [PATCH 2/3] Add unit test --- .../projects/GITHUB-1242/invoker.properties | 18 +++++++++ src/it/projects/GITHUB-1242/pom.xml | 37 +++++++++++++++++++ .../src/main/java/com/fruit/Fruits.java | 24 ++++++++++++ .../src/main/java/com/fruit/impl/Apple.java | 23 ++++++++++++ 4 files changed, 102 insertions(+) create mode 100644 src/it/projects/GITHUB-1242/invoker.properties create mode 100644 src/it/projects/GITHUB-1242/pom.xml create mode 100644 src/it/projects/GITHUB-1242/src/main/java/com/fruit/Fruits.java create mode 100644 src/it/projects/GITHUB-1242/src/main/java/com/fruit/impl/Apple.java diff --git a/src/it/projects/GITHUB-1242/invoker.properties b/src/it/projects/GITHUB-1242/invoker.properties new file mode 100644 index 000000000..b7dd444b4 --- /dev/null +++ b/src/it/projects/GITHUB-1242/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 javadoc:aggregate diff --git a/src/it/projects/GITHUB-1242/pom.xml b/src/it/projects/GITHUB-1242/pom.xml new file mode 100644 index 000000000..74737e38c --- /dev/null +++ b/src/it/projects/GITHUB-1242/pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + + org.apache.maven.plugins.javadoc.it + GITHUB-1242 + 1.0-SNAPSHOT + jar + + https://github.com/apache/maven-javadoc-plugin/issues/1242 + + + + + maven-javadoc-plugin + @project.version@ + + true + *.impl + + + + + diff --git a/src/it/projects/GITHUB-1242/src/main/java/com/fruit/Fruits.java b/src/it/projects/GITHUB-1242/src/main/java/com/fruit/Fruits.java new file mode 100644 index 000000000..a8873e728 --- /dev/null +++ b/src/it/projects/GITHUB-1242/src/main/java/com/fruit/Fruits.java @@ -0,0 +1,24 @@ +package com.fruit; + +/* + * 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 final class Fruits { + private com.fruit.impl.Apple apple; +} diff --git a/src/it/projects/GITHUB-1242/src/main/java/com/fruit/impl/Apple.java b/src/it/projects/GITHUB-1242/src/main/java/com/fruit/impl/Apple.java new file mode 100644 index 000000000..404fc7b18 --- /dev/null +++ b/src/it/projects/GITHUB-1242/src/main/java/com/fruit/impl/Apple.java @@ -0,0 +1,23 @@ +package com.fruit.impl; + +/* + * 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 final class Apple { +} From 292736e047c49079e9038b3095808fd3981248e6 Mon Sep 17 00:00:00 2001 From: Jack Date: Sun, 31 Aug 2025 07:33:20 +0100 Subject: [PATCH 3/3] Copy additional properties from `javadoc-fix-version` --- src/it/projects/GITHUB-1242/pom.xml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/it/projects/GITHUB-1242/pom.xml b/src/it/projects/GITHUB-1242/pom.xml index 74737e38c..595db3f1e 100644 --- a/src/it/projects/GITHUB-1242/pom.xml +++ b/src/it/projects/GITHUB-1242/pom.xml @@ -22,8 +22,19 @@ https://github.com/apache/maven-javadoc-plugin/issues/1242 + + UTF-8 + @maven.compiler.source@ + @maven.compiler.target@ + + + + org.apache.maven.plugins + maven-compiler-plugin + @compilerPluginVersion@ + maven-javadoc-plugin @project.version@