Scaladoc not picking up generated sources
See original GitHub issueI did some investigating and found that scaladoc is not picking up the generated sources directories when run by itself. If I ran “mvn compile scala:doc” the documents would get produced correctly. If I ran “mvn generate-sources scada:doc” it would work. Running just “mvn scala:doc” would fail because it wasn’t seeing the list of generated sources even though that phase was being executed.
The problem is the way generate-sources gets run: “@execute phase=“generate-sources””. According to the documentation at: http://maven.apache.org/developers/mojo-api-specification.html, using the @execute annotation spawns a “sub maven” that has a different project object (i verified this manually). So the source generators all correctly add their generated directories to the project object they are given but this is not the same as the one used by scala-doc. The result of that project are available as a different parameter.
/**
* @parameter expression="${executedProject}"
* @required
* @readonly
*/
protected MavenProject executedProject;
I found that in my case if i then used the executedProject reference rather than the regular project in getSourceDirectories I was able to generate scala:doc using just the one command. I am not a maven expert (though I know alot more than I did yesterday) so I wasn’t sure the reprocusions of the other executedProject and how the results should be merged together or which reference should be used for which call. I’m not sure what the right solution is but I don’t think this is doing what you expected.
Issue Analytics
- State:
- Created 12 years ago
- Comments:7 (2 by maintainers)
Top GitHub Comments
I have Java interfaces and a Scala class extending them in the same package (in their respective source dirs of course). I get
no found
errors on the interfaces even when I run onlycompile
.Using Scala 2.11.8 and Java 1.8 as target. My POM looks very much like @jvstein’s. Funny thing is Eclipse seems to compile just fine.
EDIT Sorry for the noise. I fixed my problem, leaving this if anyone else bumps into the same problem:
In maven console, with debug enabled, I saw this:
src/main/java
wasn’t getting picked up bymaven-compiler-plugin
as a source dir. After much flitting and flapping and rolling around on the floor I managed to make maven gods happy doing:<build><sourceDirectory>...
&<build><testSourceDirectory>...
.<goal>add-source</goal>
toscala-maven-plugin
. Like so:Closing as stale.