Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I include ScalaDoc options in Maven

I can generate class hierarchy diagram by manually use "scaladoc -diagrams ..."

I can also generate basic ScalaDoc with Maven by "mvn scala:doc"

But How can I put "-diagrams" in when I run ScalaDoc from Maven? In general, how do I put in any of the options that are listed in "scaladoc -help".

I have this in my pom.xml, but it doesn't work.

        <plugin>
            <groupId>org.scala-tools</groupId>
            <artifactId>maven-scala-plugin</artifactId>
            <version>2.14-SNAPSHOT</version>
            <configuration>
                <args>
                    <arg>-diagrams</arg>
                </args>
            </configuration>
         </plugin>

UPDATE

This doesn't work either:

        <plugin>
            <groupId>org.scala-tools</groupId>
            <artifactId>maven-scala-plugin</artifactId>

            <executions>
                <execution>
                    <id>generate-scaladoc</id>
                    <phase>generate-sources</phase>
                    <goals>
                        <goal>doc</goal>
                    </goals>
                    <configuration>
                        <diagrams>true</diagrams>
                        <args>
                            <arg>-diagrams</arg>
                        </args>
                    </configuration>
                </execution>
            </executions>
      </plugin>
like image 809
muon Avatar asked Dec 03 '25 12:12

muon


1 Answers

I could generate java-docs for scala maven project using the scala-maven-plugin's attach-javadocs execution as shown below:

                 <plugin>
                    <groupId>net.alchim31.maven</groupId>
                    <artifactId>scala-maven-plugin</artifactId>
                    <version>3.2.0</version>
                    <executions>
                        <execution>
                            <!-- this is so we don't end with a compile error in maven-compiler-plugin -->
                            <phase>process-sources</phase>
                            <goals>
                                <goal>compile</goal>
                                <goal>testCompile</goal>
                            </goals>
                            <configuration>
                            </configuration>
                        </execution>
                        <execution>
                            <id>attach-javadocs</id>
                            <goals>
                                <goal>doc-jar</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

Once the above specified plugin config is added, just run mvn clean install and it'll generate javadoc's jar along with sources jar

like image 184
Sruthi Poddutur Avatar answered Dec 06 '25 21:12

Sruthi Poddutur



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!