title: Maven Javadoc failed to find my subpackage - 'javadoc: warning - No source files for package'
body: <p>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. </p>
  
  <p>Exact error message is:</p>
  
  <pre><code>[WARNING] javadoc: warning - No source files for package parser
  </code></pre>
  
  <p>I've structured my project like this:</p>
  
  <pre><code>pom.xml
  src (directory)
      main (directory)
          java (directory)
              parser (directory)
                  Parser.java
                  StringParser.java
                  ByteParser.java
              Main.java
              Reader.java
  </code></pre>
  
  <p>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'. </p>
  
  <p>My pom.xml looks like this: (Deleted some stuff for brevity)</p>
  
  <pre><code>&lt;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"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;groupId&gt;com.personal.reader&lt;/groupId&gt;
      &lt;artifactId&gt;Reader&lt;/artifactId&gt;
      &lt;packaging&gt;jar&lt;/packaging&gt;
      &lt;version&gt;0.1.0&lt;/version&gt;
      &lt;name&gt;Reader&lt;/name&gt;
      &lt;url&gt;http://maven.apache.org&lt;/url&gt;
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-javadoc-plugin&lt;/artifactId&gt;
                  &lt;version&gt;3.0.0&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;outputDirectory&gt;docs&lt;/outputDirectory&gt;
                  &lt;/configuration&gt;
                  &lt;executions&gt;
                      &lt;execution&gt;
                          &lt;id&gt;attach-javadocs&lt;/id&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;jar&lt;/goal&gt;
                          &lt;/goals&gt;
                      &lt;/execution&gt;
                  &lt;/executions&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>I've tried looking for solutions. Closest thing I've found is this <a href="https://stackoverflow.com/questions/37958104/maven-javadoc-no-source-files-for-package">StackOverflow question</a>. 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. </p>
  
  <p>I have tried creating the package-info.java file in both src/main/java and src/main/java/parser. That seemed to not work.</p>
  
  <p>I tried messing with <a href="https://maven.apache.org/plugins/maven-javadoc-plugin/javadoc-mojo.html" rel="nofollow noreferrer">maven-javadoc-plugins</a>. I looked into sourceFileIncludes, includeDependencySources, subpackages, and dependencySourceIncludes. None of them seem to work. I might have missed something.</p>
  
  <p>How do I fix this issue of Maven not including the subpackage to generate Javadocs?</p>