【问题标题】:How do I configure Maven to use 'rootdoc.txt' in scaladoc report?如何将 Maven 配置为在 scaladoc 报告中使用“rootdoc.txt”?
【发布时间】:2019-05-03 02:58:03
【问题描述】:

我知道如何通过 SBT:Where does scaladoc look for the rootdoc.txt to create the root doc 执行此操作,但无法使用 Maven 解决。由于 SBT 存在缺陷,我无法将 SBT 用于一般构建。

http://davidb.github.io/scala-maven-plugin/example_doc.html 之后,我的 pom.xml 中有以下内容

        <plugin>
            <groupId>net.alchim31.maven</groupId>
            <artifactId>scala-maven-plugin</artifactId>
            <version>3.4.4</version>
            <executions>
                <execution>
                    <configuration>
                        <args>
                            <arg>-doc-root-content rootdoc.txt</arg>
                        </args>
                        <jvmArgs>
                            <jvmArg>-Xms1024m</jvmArg>
                            <jvmArg>-Xmx4096m</jvmArg>
                        </jvmArgs>
                    </configuration>
                </execution>
            </executions>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-site-plugin</artifactId>
            <version>3.0</version>
            <configuration>
                <reportPlugins>
                    <plugin>
                        <artifactId>maven-project-info-reports-plugin</artifactId>
                        <version>2.2</version>
                    </plugin>
                    <plugin>
                        <groupId>net.alchim31.maven</groupId>
                        <artifactId>scala-maven-plugin</artifactId>
                        <version>3.4.4</version>
                        <configuration>
                            <args>
                                <arg>-doc-root-content rootdoc.txt</arg>
                            </args>
                            <jvmArgs>
                                <jvmArg>-Xms64m</jvmArg>
                                <jvmArg>-Xmx1024m</jvmArg>
                            </jvmArgs>
                        </configuration>
                    </plugin>
                    ...
                </reportPlugins>
            </configuration>
        </plugin>

包含 API Docs 的根文档会非常好,而不必使用 SBT 来生成文档。

【问题讨论】:

    标签: scala maven sbt maven-3 scaladoc


    【解决方案1】:

    &lt;arg&gt; 应该只包含一个参数,而不是 2 个。 试试看

                        <args>
                            <arg>-doc-root-content<arg>
                            <arg>rootdoc.txt</arg>
                        </args>
    

    注意:同上 SBT 有 2 个字符串:

    scalacOptions in Compile ++= Seq("-doc-root-content", "rootdoc.txt")
    

    更新:

    【讨论】:

    • 我也试过了,但没有运气。将尝试使用其他一些变体。
    • 好的,找到问题了,我在rootdoc.txt前面有一个破折号,所以这个工作:-)
    • 所以,现在的问题是,当我使用mvn compile 时,我可以使用mvn scala:doc 生成文档,但我得到[ERROR] scalac error: bad option: '-doc-root-content'
    猜你喜欢
    • 2011-03-28
    • 1970-01-01
    • 2010-11-19
    • 1970-01-01
    • 2012-11-28
    • 1970-01-01
    • 1970-01-01
    • 2016-04-14
    • 1970-01-01
    相关资源
    最近更新 更多