Reputation: 31
I used this in my pom.xml to recognize the second source directory I have in my project:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>src/main/java-extra/</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
But generating javadoc fails saying it can't find the classes in the java-extra
directory. How can I make maven javadoc see the second directory?
Upvotes: 3
Views: 853
Reputation: 372
There is a sourcepath parameter for maven-javadoc-plugin. There you provide list of your source folders, separated by :
or ;
. See https://maven.apache.org/plugins/maven-javadoc-plugin/javadoc-mojo.html#sourcepath
For example:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.3.2</version>
<configuration>
<sourcepath>src/main/java;${defines.dir}</sourcepath>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
Upvotes: 2