[ 
https://issues.apache.org/jira/browse/MJAVADOC-767?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17755420#comment-17755420
 ] 

ASF GitHub Bot commented on MJAVADOC-767:
-----------------------------------------

slawekjaranowski commented on code in PR #225:
URL: 
https://github.com/apache/maven-javadoc-plugin/pull/225#discussion_r1296852969


##########
src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java:
##########
@@ -4594,12 +4594,14 @@ private void addJavadocOptions(
         }
 
         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);
+            }

Review Comment:
   Is it possible to add a test (unit or IT) for verifying this change?





> javadoc creates invalid --patch-module statements
> -------------------------------------------------
>
>                 Key: MJAVADOC-767
>                 URL: https://issues.apache.org/jira/browse/MJAVADOC-767
>             Project: Maven Javadoc Plugin
>          Issue Type: Bug
>          Components: jar
>    Affects Versions: 3.5.0
>            Reporter: Henning Schmiedehausen
>            Priority: Major
>
> Jdbi is a mixed Java/Kotlin multi-module project. We aggregate a final jar 
> that contains all the javadocs for all modules in a doc step. This works ok 
> for non-JPMS (Java 8 target).
> When introducing JPMS into our project, the javadoc plugin starts adding 
> --patch-module options like this:
> {{--patch-module 
> org.jdbi.v3.caffeine='/Users/henning/code/jdbi/cache/caffeine-cache/src/main/java:/Users/henning/code/jdbi/cache/caffeine-cache/target/generated-sources/annotations'}}
> However, in our configuration, we exclude the kotlin specific modules:
> {code:xml}
>   <plugin>
>     <artifactId>maven-javadoc-plugin</artifactId>
>     <executions>
>         <execution>
>             <id>javadoc-jar</id>
>             <goals>
>                 <goal>jar</goal>
>             </goals>
>             <phase>package</phase>
>             <configuration>
>                 <includeDependencySources>true</includeDependencySources>
>                 <detectOfflineLinks>false</detectOfflineLinks>
>                 <dependencySourceIncludes>
>                     
> <dependencySourceInclude>org.jdbi:*</dependencySourceInclude>
>                 </dependencySourceIncludes>
>                 <dependencySourceExcludes>
>                     
> <dependencySourceExclude>org.jdbi:jdbi3-kotlin</dependencySourceExclude>
>                     
> <dependencySourceExclude>org.jdbi:jdbi3-kotlin-sqlobject</dependencySourceExclude>
>                 </dependencySourceExcludes>
>                 
> <skippedModules>jdbi3-kotlin,jdbi3-kotlin-sqlobject</skippedModules>
>                 <doctitle>Jdbi3 ${project.version} API</doctitle>
>                 <windowtitle>Jdbi3 ${project.version} API</windowtitle>
>             </configuration>
>         </execution>
>     </executions>
>   </plugin>
> {code}
> which results in the maven-javadoc-plugin creating command line options like 
> this:
> {{--patch-module org.jdbi.v3.kotlin=}}
> which in turn crash the javadoc command.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to