How to generate an aggregated scaladoc for a maven site?

前端 未结 1 1480
情书的邮戳
情书的邮戳 2021-02-05 16:59

I have a multi-module Maven build and I would like to generate an aggregated Scaladoc in my root module, similar to what the aggregate goal for the maven-javadoc-plugin does. My

1条回答
  •  温柔的废话
    2021-02-05 17:52

    This doesn't answer the question exactly as asked, but is a solution that may actually be preferred for mixed java/scala projects until ScalaDoc is capable of parsing JavaDoc comments. It produces a single aggregated JavaDoc that includes documentation from all of the project's Scala source files as well.

    The solution is simple: configure Maven to use the GenJavaDoc Scala compiler plugin so that ScalaDocs can be converted to JavaDocs. Then, use the normal javadoc:aggregate goal to aggregate the project as normal.

    Here is a sample Maven profile to do this. It configures the Scala compiler to generate the JavaDocs corresponding to the Scala sources, configures Maven to treat the genjavadoc directory created by the Scala compiler as a source directory, and then configures the javadoc plugin itself (this last may be optional if you have no special JavaDoc plugin configuration requirements).

    
      javadoc
      
        
          
            net.alchim31.maven
            scala-maven-plugin
            
              
                doc
                generate-sources
                
                  compile
                
              
            
            
              
                -P:genjavadoc:out=${project.build.directory}/genjavadoc
              
              
                
                  com.typesafe.genjavadoc
                  genjavadoc-plugin_${scala.binary.full.version}
                  0.4
                
              
            
          
          
            org.codehaus.mojo
            build-helper-maven-plugin
            
              
                generate-sources
                
                  add-source
                
                
                  
                    ${project.build.directory}/genjavadoc
                  
                
              
            
          
          
            org.apache.maven.plugins
            maven-javadoc-plugin
            2.9
            
              64m
              2g
              ${project.build.directory}
              true
            
          
        
      
    
    

    0 讨论(0)
提交回复
热议问题