I have this Maven project. I am trying to have Maven to automatically generate JavaDocs when mvn package is issued. The whole project compiles and packages just fine. It've generated documentation for all of my Java classes that are in the main package just fine but it did not generate documentation for any classes in sub packages. It said that it could not find them.
Exact error message is:
[WARNING] javadoc: warning - No source files for package parser
I've structured my project like this:
pom.xml
src (directory)
main (directory)
java (directory)
parser (directory)
Parser.java
StringParser.java
ByteParser.java
Main.java
Reader.java
The classes Main.java and Reader.java has 'package com.personal.reader;'. The classes in parser directory has 'package com.personal.reader.parser;'. It appears that the error message was saying that it cannot find 'com.personal.reader.parser'.
My pom.xml looks like this: (Deleted some stuff for brevity)
<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 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.personal.reader</groupId>
<artifactId>Reader</artifactId>
<packaging>jar</packaging>
<version>0.1.0</version>
<name>Reader</name>
<url>http://maven.apache.org</url>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<outputDirectory>docs</outputDirectory>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
I've tried looking for solutions. Closest thing I've found is this StackOverflow question. There appears to be no clear answer. I've tried compiling the project that was linked in the submitter's answer to see if he had solved it or not. The submitter's project still exhibited same problems as I am having.
I have tried creating the package-info.java file in both src/main/java and src/main/java/parser. That seemed to not work.
I tried messing with maven-javadoc-plugins. I looked into sourceFileIncludes, includeDependencySources, subpackages, and dependencySourceIncludes. None of them seem to work. I might have missed something.
How do I fix this issue of Maven not including the subpackage to generate Javadocs?