[ https://issues.apache.org/jira/browse/MJAVADOC-329?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17272302#comment-17272302 ]
John Robert Fallows edited comment on MJAVADOC-329 at 1/26/21, 6:16 PM: ------------------------------------------------------------------------ Pull request implementing *generateIfEmpty* for *javadoc:jar* goal. {{[https://github.com/apache/maven-javadoc-plugin/pull/65]}} {{ <plugin>}} {{ <groupId>org.apache.maven.plugins</groupId>}} {{ <artifactId>maven-antrun-plugin</artifactId>}} {{ <executions>}} {{ <execution>}} {{ <phase>package</phase>}} {{ <configuration>}} {{ <target>}} {{ <mkdir dir="${project.build.directory}/apidocs" />}} {{ </target>}} {{ </configuration>}} {{ <goals>}} {{ <goal>run</goal>}} {{ </goals>}} {{ </execution>}} {{ </executions>}} {{ </plugin>}} {{ <plugin>}} {{ <groupId>org.apache.maven.plugins</groupId>}} {{ <artifactId>maven-javadoc-plugin</artifactId>}} {{ <version>3.2.0</version>}} {{ <configuration>}} {{ <sourceFileExcludes>}} {{ <exclude>**/internal/**/*.java</exclude>}} {{ </sourceFileExcludes>}} {{ </configuration>}} {{ <executions>}} {{ <execution>}} {{ <goals>}} {{ <goal>jar</goal>}} {{ </goals>}} {{ </execution>}} {{ </executions>}} {{ </plugin>}} {{where no non-internal classes exist, therefore no public Javadoc is required, yet Maven Central requires inclusion of a Javadoc JAR during deployment.}} {{This now simplifies to}} {{<plugin>}} {{ <groupId>org.apache.maven.plugins</groupId>}} {{ <artifactId>maven-javadoc-plugin</artifactId>}} {{ <version>3.2.1</version>}} {{ <configuration>}} {{ <sourceFileExcludes>}} {{ <exclude>**/internal/**/*.java</exclude>}} {{ </sourceFileExcludes>}} {{ <generateIfEmpty>true</generateIfEmpty>}} {{ </configuration>}} {{ <executions>}} {{ <execution>}} {{ <goals>}} {{ <goal>jar</goal>}} {{ </goals>}} {{ </execution>}} {{ </executions>}} {{ </plugin>}} was (Author: jfallows): Pull request implementing *generateIfEmpty* for *javadoc:jar* goal. [https://github.com/apache/maven-javadoc-plugin/pull/65] <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-antrun-plugin</artifactId> <executions> <execution> <phase>package</phase> <configuration> <target> <mkdir dir="${project.build.directory}/apidocs" /> </target> </configuration> <goals> <goal>run</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> <version>3.2.0</version> <configuration> <sourceFileExcludes> <exclude>**/internal/**/*.java</exclude> </sourceFileExcludes> </configuration> <executions> <execution> <goals> <goal>jar</goal> </goals> </execution> </executions> </plugin> {{}}where no non-internal classes exist, therefore no public Javadoc is required, yet Maven Central requires inclusion of a Javadoc JAR during deployment. This now simplifies to <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> <version>3.2.1</version> <configuration> <sourceFileExcludes> <exclude>**/internal/**/*.java</exclude> </sourceFileExcludes> <generateIfEmpty>true</generateIfEmpty> </configuration> <executions> <execution> <goals> <goal>jar</goal> </goals> </execution> </executions> </plugin> > Allow generation of empty javadoc JARs > -------------------------------------- > > Key: MJAVADOC-329 > URL: https://issues.apache.org/jira/browse/MJAVADOC-329 > Project: Maven Javadoc Plugin > Issue Type: Improvement > Affects Versions: 2.8 > Reporter: Vincent Massol > Assignee: Robert Scholte > Priority: Major > > Here's my use case: > * I want to be able to deploy my artifacts to Maven Central. There's a > requirement that a javadoc jar exists for the arifact to deploy > * However I have some maven modules of type packaging = jar that have java > files but these files are located in an "internal" package (internal api that > we don't expose to end users since it's not part of our public API contract) > which we exclude from the javadoc generation > The problem is that the javadoc plugin doesn't generate any JAR if there are > no java files matching (even if I have other files such as a package.html > file in my src/main/javadoc/* directories). > I'd like it to be possible to generate an "empty" javadoc JAR containing only > a package.html file for example. > Thanks a lot -- This message was sent by Atlassian Jira (v8.3.4#803005)