This is an automated email from the ASF dual-hosted git repository. henning 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 89316c9d [MJAVADOC-767] javadoc creates invalid --patch-module statements (#225) 89316c9d is described below commit 89316c9d47909a5ab1d6a97c056598a63eb2a667 Author: Henning Schmiedehausen <henn...@schmiedehausen.org> AuthorDate: Sun Aug 20 13:08:05 2023 -0700 [MJAVADOC-767] javadoc creates invalid --patch-module statements (#225) Fixes empty --patch-module command line entries When using an exclude filter, it is possible that the plugin creates javadoc --patch-module command line options, that do not actually have a value. This changes skips such empty entries. --- src/it/projects/MJAVADOC-767/doc/pom.xml | 69 ++++++++++++++++++++++ src/it/projects/MJAVADOC-767/invoker.properties | 19 ++++++ src/it/projects/MJAVADOC-767/pom.xml | 36 +++++++++++ src/it/projects/MJAVADOC-767/thing1/pom.xml | 26 ++++++++ .../thing1/src/main/java/jdbug/thing1/Main.java | 26 ++++++++ .../thing1/src/main/java/module-info.java | 22 +++++++ src/it/projects/MJAVADOC-767/thing2/pom.xml | 26 ++++++++ .../thing2/src/main/java/jdbug/thing2/Main.java | 26 ++++++++ .../thing2/src/main/java/module-info.java | 22 +++++++ .../maven/plugins/javadoc/AbstractJavadocMojo.java | 14 +++-- 10 files changed, 280 insertions(+), 6 deletions(-) diff --git a/src/it/projects/MJAVADOC-767/doc/pom.xml b/src/it/projects/MJAVADOC-767/doc/pom.xml new file mode 100644 index 00000000..e9bc5d68 --- /dev/null +++ b/src/it/projects/MJAVADOC-767/doc/pom.xml @@ -0,0 +1,69 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +~ Licensed 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 https://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.maven.plugins.javadoc.it</groupId> + <artifactId>mjavadoc767</artifactId> + <version>1.0-SNAPSHOT</version> + </parent> + + <artifactId>doc</artifactId> + <packaging>pom</packaging> + + <dependencies> + <dependency> + <groupId>org.apache.maven.plugins.javadoc.it</groupId> + <artifactId>thing1</artifactId> + <version>1.0-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>org.apache.maven.plugins.javadoc.it</groupId> + <artifactId>thing2</artifactId> + <version>1.0-SNAPSHOT</version> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <artifactId>maven-javadoc-plugin</artifactId> + <version>@project.version@</version> + <executions> + <execution> + <id>javadoc-jar</id> + <goals> + <goal>aggregate-jar</goal> + </goals> + <phase>package</phase> + <configuration> + <jvmVersion>9</jvmVersion> + <skip>false</skip> + <includeDependencySources>true</includeDependencySources> + <detectOfflineLinks>false</detectOfflineLinks> + <dependencySourceIncludes> + <dependencySourceInclude>*:*</dependencySourceInclude> + </dependencySourceIncludes> + <dependencySourceExcludes> + <dependencySourceExclude>*:thing2</dependencySourceExclude> + </dependencySourceExcludes> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> diff --git a/src/it/projects/MJAVADOC-767/invoker.properties b/src/it/projects/MJAVADOC-767/invoker.properties new file mode 100644 index 00000000..c30bd85d --- /dev/null +++ b/src/it/projects/MJAVADOC-767/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-767/pom.xml b/src/it/projects/MJAVADOC-767/pom.xml new file mode 100644 index 00000000..d17cb7eb --- /dev/null +++ b/src/it/projects/MJAVADOC-767/pom.xml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +~ Licensed 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 https://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <groupId>org.apache.maven.plugins.javadoc.it</groupId> + <artifactId>mjavadoc767</artifactId> + <version>1.0-SNAPSHOT</version> + <packaging>pom</packaging> + + <url>https://issues.apache.org/jira/browse/MJAVADOC-767</url> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <maven.compiler.source>9</maven.compiler.source> + <maven.compiler.target>9</maven.compiler.target> + </properties> + + <modules> + <module>thing1</module> + <module>thing2</module> + <module>doc</module> + </modules> +</project> diff --git a/src/it/projects/MJAVADOC-767/thing1/pom.xml b/src/it/projects/MJAVADOC-767/thing1/pom.xml new file mode 100644 index 00000000..7a310fa5 --- /dev/null +++ b/src/it/projects/MJAVADOC-767/thing1/pom.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +~ Licensed 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 https://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.maven.plugins.javadoc.it</groupId> + <artifactId>mjavadoc767</artifactId> + <version>1.0-SNAPSHOT</version> + </parent> + + <artifactId>thing1</artifactId> + <packaging>jar</packaging> +</project> diff --git a/src/it/projects/MJAVADOC-767/thing1/src/main/java/jdbug/thing1/Main.java b/src/it/projects/MJAVADOC-767/thing1/src/main/java/jdbug/thing1/Main.java new file mode 100644 index 00000000..8d6618fd --- /dev/null +++ b/src/it/projects/MJAVADOC-767/thing1/src/main/java/jdbug/thing1/Main.java @@ -0,0 +1,26 @@ +/* + * 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 jdbug.thing1; + +public final class Main { + public static final void main(String ... args) throws Exception { + System.out.println("Hello, World!"); + } +} diff --git a/src/it/projects/MJAVADOC-767/thing1/src/main/java/module-info.java b/src/it/projects/MJAVADOC-767/thing1/src/main/java/module-info.java new file mode 100644 index 00000000..b880104c --- /dev/null +++ b/src/it/projects/MJAVADOC-767/thing1/src/main/java/module-info.java @@ -0,0 +1,22 @@ +/* + * 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. + */ + +module jdbug.thing1 { + exports jdbug.thing1; +} diff --git a/src/it/projects/MJAVADOC-767/thing2/pom.xml b/src/it/projects/MJAVADOC-767/thing2/pom.xml new file mode 100644 index 00000000..6b0a9320 --- /dev/null +++ b/src/it/projects/MJAVADOC-767/thing2/pom.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +~ Licensed 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 https://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.maven.plugins.javadoc.it</groupId> + <artifactId>mjavadoc767</artifactId> + <version>1.0-SNAPSHOT</version> + </parent> + + <artifactId>thing2</artifactId> + <packaging>jar</packaging> +</project> diff --git a/src/it/projects/MJAVADOC-767/thing2/src/main/java/jdbug/thing2/Main.java b/src/it/projects/MJAVADOC-767/thing2/src/main/java/jdbug/thing2/Main.java new file mode 100644 index 00000000..9aef86fc --- /dev/null +++ b/src/it/projects/MJAVADOC-767/thing2/src/main/java/jdbug/thing2/Main.java @@ -0,0 +1,26 @@ +/* + * 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 jdbug.thing2; + +public final class Main { + public static final void main(String ... args) throws Exception { + System.out.println("Hello, World!"); + } +} diff --git a/src/it/projects/MJAVADOC-767/thing2/src/main/java/module-info.java b/src/it/projects/MJAVADOC-767/thing2/src/main/java/module-info.java new file mode 100644 index 00000000..28ce9ed2 --- /dev/null +++ b/src/it/projects/MJAVADOC-767/thing2/src/main/java/module-info.java @@ -0,0 +1,22 @@ +/* + * 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. + */ + +module jdbug.thing2 { + exports jdbug.thing2; +} 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 a2ba79fd..18fea1cc 100644 --- a/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java +++ b/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java @@ -4594,12 +4594,14 @@ public abstract class AbstractJavadocMojo extends AbstractMojo { } for (Entry<String, Collection<Path>> entry : patchModules.entrySet()) { - addArgIfNotEmpty( - arguments, - "--patch-module", - entry.getKey() + '=' + JavadocUtil.quotedPathArgument(getSourcePath(entry.getValue())), - false, - false); + if (!entry.getValue().isEmpty()) { + addArgIfNotEmpty( + arguments, + "--patch-module", + entry.getKey() + '=' + JavadocUtil.quotedPathArgument(getSourcePath(entry.getValue())), + false, + false); + } } if (doclet != null && !doclet.isEmpty()) {