Details
-
Type:
New Feature
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 2.0-beta-3
-
Fix Version/s: 2.1
-
Labels:None
-
Environment:FedoreCore 4 kernel 2.6.10-1.760_FC3smp #1
-
Number of attachments :
Description
I have a code generator that creates sources during the compile stage. These sources end up in a custom directory ($
{project.build.directory}/generated-sources/main/java). The problem is that javadoc skips these files when it generates the documentation. What I'm looking for is a way to manipulate javadoc's sourcefilenames argument.I have already tried adding <sourceRoot>${project.build.directory}
/generated-sources/main/java</sourceRoot> to the code generation step, but it didn't affect javadoc.
I ran into the same problem. To fix it, you'll need to insert javadoc plugin into the build lifecycle at such point where any additional compile source roots have already been added to the project.
E.g.:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<phase>process-sources</phase>
<goals>
<goal>javadoc</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
{project.build.directory}<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>generate-sources</phase>
<configuration>
<sourceRoot>$
/generated/java</sourceRoot>
<tasks>
... some ant tasks
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
Here javadoc plugin is invoked after antrun plugin and therefore given sourceRoot is added to projects compile source roots. This may not be the right way to do it but that's how I got it working. Also notice that your code generator must be run from a plugin that adds the compile source root into the project like antrun does. Hope this is of any help.