org.scala_tools.maven
Class ScalaDocMojo

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by org.scala_tools.maven.ScalaDocMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo, org.apache.maven.reporting.MavenReport

public class ScalaDocMojo
extends org.apache.maven.plugin.AbstractMojo
implements org.apache.maven.reporting.MavenReport

Produces Scala API documentation.


Field Summary
protected  boolean aggregateDirectOnly
          If you want to aggregate only direct sub modules.
protected  String[] args
          compiler additionnals arguments
protected  String bottom
          Specifies the text to be placed at the bottom of each output file.
protected  String charset
          Charset for cross-platform viewing of generated documentation.
protected  boolean checkMultipleScalaVersions
          Check if every dependencies use the same version of scala-library.
protected  BasicArtifact[] compilerPlugins
          Compiler plugin dependencies to use when compiling.
protected  BasicArtifact[] dependencies
          Additional dependencies/jar to add to classpath to run "scalaClassName" (scope and optional field not supported) ex : <dependencies> <dependency> <groupId>org.scala-tools</groupId> <artifactId>scala-compiler-addon</artifactId> <version>1.0-SNAPSHOT</version> </dependency> </dependencies>
protected  boolean displayCmd
          Display the command line called ?
protected  String doctitle
          Include title for the overview page.
protected  org.apache.maven.artifact.factory.ArtifactFactory factory
          Used to look up Artifacts in the remote repository.
protected  boolean failOnMultipleScalaVersions
          Determines if a detection of multiple scala versions in the dependencies will cause the build to fail.
protected  String footer
          Include footer text for each page.
protected  boolean forceAggregate
          To allow running aggregation only from command line use "-Dforce-aggregate=true" (avoid using in pom.xml).
protected  boolean forceUseArgFile
          Force the use of an external ArgFile to run any forked process.
protected  boolean fork
          Forks the execution of scalac into a separate process.
protected  String header
          Include header text for each page
protected  String[] jvmArgs
          Jvm Arguments.
protected  boolean linksource
          Generate source in HTML
protected  org.apache.maven.artifact.repository.ArtifactRepository localRepo
          Location of the local repository.
protected  org.apache.maven.project.MavenProjectBuilder mavenProjectBuilder
          Artifact factory, needed to download source jars.
protected  boolean nocomment
          Suppress description and tags, generate only declarations
protected  org.apache.maven.project.MavenProject project
           
protected  List<?> remoteRepos
          List of Remote Repositories used by the resolver
protected  org.apache.maven.artifact.resolver.ArtifactResolver resolver
          Used to look up Artifacts in the remote repository.
static String SCALA_GROUPID
           
static String SCALA_LIBRARY_ARTIFACTID
           
protected  String scalaClassName
          className (FQN) of the scala tool to provide as
protected  String scaladocClassName
          className (FQN) of the main scaladoc to use, if not define, the the scalaClassName is used
protected  String scalaVersion
          Scala 's version to use
protected  File sourceDir
           
protected  File stylesheetfile
          File to change style of the generated documentation
protected  String top
          Include top text for each page
protected  String vscaladocVersion
          If you want to use vscaladoc to generate api instead of regular scaladoc, set the version of vscaladoc you want to use.
protected  String windowtitle
          Specify window title of generated HTML documentation.
 
Fields inherited from interface org.apache.maven.reporting.MavenReport
CATEGORY_PROJECT_INFORMATION, CATEGORY_PROJECT_REPORTS, ROLE
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
ScalaDocMojo()
           
 
Method Summary
protected  void addToClasspath(org.apache.maven.artifact.Artifact artifact, Set<String> classpath)
           
protected  void addToClasspath(String groupId, String artifactId, String version, Set<String> classpath)
           
protected  void aggregate(org.apache.maven.project.MavenProject parent)
           
 boolean canGenerateReport()
           
protected  void checkScalaVersion()
           
 void doExecute()
           
 void execute()
           
 void generate(org.apache.maven.doxia.sink.Sink sink, Locale locale)
           
 String getCategoryName()
           
protected  List<org.apache.maven.model.Dependency> getDependencies()
           
 String getDescription(Locale locale)
           
protected  JavaMainCaller getEmptyScalaCommand(String mainClass)
           
 String getName(Locale locale)
           
 String getOutputName()
           
 File getReportOutputDirectory()
           
protected  JavaMainCaller getScalaCommand()
           
 boolean isExternalReport()
           
protected  boolean isJavaSupportedByCompiler()
           
protected  JavaMainCaller newScalaDocCmd()
           
protected  Set<org.apache.maven.artifact.Artifact> resolveArtifactDependencies(org.apache.maven.artifact.Artifact artifact)
          This method resolves all transitive dependencies of an artifact.
protected  Set<org.apache.maven.artifact.Artifact> resolveDependencyArtifacts(org.apache.maven.project.MavenProject theProject)
          This method resolves the dependency artifacts from the project.
 void setReportOutputDirectory(File reportOutputDirectory)
           
 
Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

windowtitle

protected String windowtitle
Specify window title of generated HTML documentation.


bottom

protected String bottom
Specifies the text to be placed at the bottom of each output file. If you want to use html you have to put it in a CDATA section, eg. <![CDATA[Copyright 2005, <a href="http://www.mycompany.com">MyCompany, Inc.<a>]]>


charset

protected String charset
Charset for cross-platform viewing of generated documentation.


doctitle

protected String doctitle
Include title for the overview page.


footer

protected String footer
Include footer text for each page.


header

protected String header
Include header text for each page


linksource

protected boolean linksource
Generate source in HTML


nocomment

protected boolean nocomment
Suppress description and tags, generate only declarations


stylesheetfile

protected File stylesheetfile
File to change style of the generated documentation


top

protected String top
Include top text for each page


sourceDir

protected File sourceDir

scaladocClassName

protected String scaladocClassName
className (FQN) of the main scaladoc to use, if not define, the the scalaClassName is used


vscaladocVersion

protected String vscaladocVersion
If you want to use vscaladoc to generate api instead of regular scaladoc, set the version of vscaladoc you want to use.


forceAggregate

protected boolean forceAggregate
To allow running aggregation only from command line use "-Dforce-aggregate=true" (avoid using in pom.xml).


aggregateDirectOnly

protected boolean aggregateDirectOnly
If you want to aggregate only direct sub modules.


SCALA_GROUPID

public static final String SCALA_GROUPID
See Also:
Constant Field Values

SCALA_LIBRARY_ARTIFACTID

public static final String SCALA_LIBRARY_ARTIFACTID
See Also:
Constant Field Values

project

protected org.apache.maven.project.MavenProject project

factory

protected org.apache.maven.artifact.factory.ArtifactFactory factory
Used to look up Artifacts in the remote repository.


resolver

protected org.apache.maven.artifact.resolver.ArtifactResolver resolver
Used to look up Artifacts in the remote repository.


localRepo

protected org.apache.maven.artifact.repository.ArtifactRepository localRepo
Location of the local repository.


remoteRepos

protected List<?> remoteRepos
List of Remote Repositories used by the resolver


dependencies

protected BasicArtifact[] dependencies
Additional dependencies/jar to add to classpath to run "scalaClassName" (scope and optional field not supported) ex : <dependencies> <dependency> <groupId>org.scala-tools</groupId> <artifactId>scala-compiler-addon</artifactId> <version>1.0-SNAPSHOT</version> </dependency> </dependencies>


compilerPlugins

protected BasicArtifact[] compilerPlugins
Compiler plugin dependencies to use when compiling. ex:


jvmArgs

protected String[] jvmArgs
Jvm Arguments.


args

protected String[] args
compiler additionnals arguments


scalaClassName

protected String scalaClassName
className (FQN) of the scala tool to provide as


scalaVersion

protected String scalaVersion
Scala 's version to use


displayCmd

protected boolean displayCmd
Display the command line called ?


fork

protected boolean fork
Forks the execution of scalac into a separate process.


forceUseArgFile

protected boolean forceUseArgFile
Force the use of an external ArgFile to run any forked process.


checkMultipleScalaVersions

protected boolean checkMultipleScalaVersions
Check if every dependencies use the same version of scala-library.


failOnMultipleScalaVersions

protected boolean failOnMultipleScalaVersions
Determines if a detection of multiple scala versions in the dependencies will cause the build to fail.


mavenProjectBuilder

protected org.apache.maven.project.MavenProjectBuilder mavenProjectBuilder
Artifact factory, needed to download source jars.

Constructor Detail

ScalaDocMojo

public ScalaDocMojo()
Method Detail

canGenerateReport

public boolean canGenerateReport()
Specified by:
canGenerateReport in interface org.apache.maven.reporting.MavenReport

isExternalReport

public boolean isExternalReport()
Specified by:
isExternalReport in interface org.apache.maven.reporting.MavenReport

getCategoryName

public String getCategoryName()
Specified by:
getCategoryName in interface org.apache.maven.reporting.MavenReport

getDescription

public String getDescription(Locale locale)
Specified by:
getDescription in interface org.apache.maven.reporting.MavenReport

getName

public String getName(Locale locale)
Specified by:
getName in interface org.apache.maven.reporting.MavenReport

getOutputName

public String getOutputName()
Specified by:
getOutputName in interface org.apache.maven.reporting.MavenReport

getReportOutputDirectory

public File getReportOutputDirectory()
Specified by:
getReportOutputDirectory in interface org.apache.maven.reporting.MavenReport

setReportOutputDirectory

public void setReportOutputDirectory(File reportOutputDirectory)
Specified by:
setReportOutputDirectory in interface org.apache.maven.reporting.MavenReport

doExecute

public void doExecute()
               throws Exception
Throws:
Exception

getScalaCommand

protected JavaMainCaller getScalaCommand()
                                  throws Exception
Throws:
Exception

generate

public void generate(org.apache.maven.doxia.sink.Sink sink,
                     Locale locale)
              throws org.apache.maven.reporting.MavenReportException
Specified by:
generate in interface org.apache.maven.reporting.MavenReport
Throws:
org.apache.maven.reporting.MavenReportException

newScalaDocCmd

protected JavaMainCaller newScalaDocCmd()
                                 throws Exception
Throws:
Exception

aggregate

protected void aggregate(org.apache.maven.project.MavenProject parent)
                  throws Exception
Throws:
Exception

resolveDependencyArtifacts

protected Set<org.apache.maven.artifact.Artifact> resolveDependencyArtifacts(org.apache.maven.project.MavenProject theProject)
                                                                      throws Exception
This method resolves the dependency artifacts from the project.

Parameters:
theProject - The POM.
Returns:
resolved set of dependency artifacts.
Throws:
org.apache.maven.artifact.resolver.ArtifactResolutionException
org.apache.maven.artifact.resolver.ArtifactNotFoundException
org.apache.maven.project.artifact.InvalidDependencyVersionException
Exception

resolveArtifactDependencies

protected Set<org.apache.maven.artifact.Artifact> resolveArtifactDependencies(org.apache.maven.artifact.Artifact artifact)
                                                                       throws Exception
This method resolves all transitive dependencies of an artifact.

Parameters:
artifact - the artifact used to retrieve dependencies
Returns:
resolved set of dependencies
Throws:
org.apache.maven.artifact.resolver.ArtifactResolutionException
org.apache.maven.artifact.resolver.ArtifactNotFoundException
org.apache.maven.project.ProjectBuildingException
org.apache.maven.project.artifact.InvalidDependencyVersionException
Exception

addToClasspath

protected void addToClasspath(String groupId,
                              String artifactId,
                              String version,
                              Set<String> classpath)
                       throws Exception
Throws:
Exception

addToClasspath

protected void addToClasspath(org.apache.maven.artifact.Artifact artifact,
                              Set<String> classpath)
                       throws Exception
Throws:
Exception

execute

public void execute()
             throws org.apache.maven.plugin.MojoExecutionException,
                    org.apache.maven.plugin.MojoFailureException
Throws:
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException

getDependencies

protected List<org.apache.maven.model.Dependency> getDependencies()

checkScalaVersion

protected void checkScalaVersion()
                          throws Exception
Throws:
Exception

getEmptyScalaCommand

protected JavaMainCaller getEmptyScalaCommand(String mainClass)
                                       throws Exception
Throws:
Exception

isJavaSupportedByCompiler

protected boolean isJavaSupportedByCompiler()
Returns:
This returns whether or not the scala version can support having java sent into the compiler


Copyright © 2009-2010 Scala Tools. All Rights Reserved.