com.google.code.sbt
Class AbstractSBTCompileMojo

Package class diagram package AbstractSBTCompileMojo
java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by com.google.code.sbt.AbstractSBTCompileMojo
All Implemented Interfaces:
ContextEnabled, Mojo
Direct Known Subclasses:
SBTCompileMojo, SBTTestCompileMojo

public abstract class AbstractSBTCompileMojo
extends AbstractMojo

Abstract base class for SBT compilation mojos.

Author:
Grzegorz Slowikowski

Field Summary
static String DEFAULT_SCALA_VERSION
          Default Scala library and compiler version used when no scalaVersion configuration property specified and org.scala-lang:scala-library dependency not found in the project.
protected  ArtifactFactory factory
          Artifact factory used to look up artifacts in the remote repository.
protected  String javacOptions
          Additional parameters for Java compiler.
protected  ArtifactRepository localRepo
          Location of the local repository.
protected  MavenProjectBuilder mavenProjectBuilder
          Maven project builder used to resolve artifacts.
protected  MavenProject project
          Maven Internal: Project to interact with.
protected  List<MavenProject> reactorProjects
          All projects in the reactor.
protected  List<?> remoteRepos
          List of Remote Repositories used by the resolver
protected  ArtifactResolver resolver
          Artifact resolver used to resolve artifacts.
protected  String scalacOptions
          Additional parameters for Scala compiler.
protected  String sourceEncoding
          The -encoding argument for Scala and Java compilers.
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
AbstractSBTCompileMojo()
           
 
Method Summary
protected  File defaultAnalysisCacheFile(MavenProject p)
          Returns incremental main compilation analysis cache file location for a project.
protected  File defaultTestAnalysisCacheFile(MavenProject p)
          Returns incremental test compilation analysis cache file location for a project.
 void execute()
          Performs compilation.
protected abstract  File getAnalysisCacheFile()
          Returns incremental compilation analysis cache file.
protected abstract  Map<File,File> getAnalysisCacheMap()
          Returns incremental compilation analyses map for reactor projects.
protected abstract  List<String> getClasspathElements()
          Returns compilation classpath elements.
protected abstract  List<String> getCompileSourceRoots()
          Returns compilation source roots.
protected abstract  File getOutputDirectory()
          Returns output directory.
protected abstract  Set<String> getSourceExcludes()
          A list of exclusion filters for the compiler.
protected abstract  Set<String> getSourceIncludes()
          A list of inclusion filters for the compiler.
protected  void internalExecute()
          Actual compilation code, to be overridden.
 
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

DEFAULT_SCALA_VERSION

public static final String DEFAULT_SCALA_VERSION
Default Scala library and compiler version used when no scalaVersion configuration property specified and org.scala-lang:scala-library dependency not found in the project.

See Also:
Constant Field Values

sourceEncoding

@Parameter(property="project.build.sourceEncoding")
protected String sourceEncoding
The -encoding argument for Scala and Java compilers.

Since:
1.0.0

javacOptions

@Parameter(property="sbt.javacOptions",
           defaultValue="-g")
protected String javacOptions
Additional parameters for Java compiler.

Since:
1.0.0

scalacOptions

@Parameter(property="sbt.scalacOptions",
           defaultValue="-deprecation -unchecked")
protected String scalacOptions
Additional parameters for Scala compiler.

Since:
1.0.0

project

@Component
protected MavenProject project
Maven Internal: Project to interact with.


mavenProjectBuilder

@Component
protected MavenProjectBuilder mavenProjectBuilder
Maven project builder used to resolve artifacts.


reactorProjects

@Parameter(defaultValue="${reactorProjects}",
           required=true,
           readonly=true)
protected List<MavenProject> reactorProjects
All projects in the reactor.


factory

@Component
protected ArtifactFactory factory
Artifact factory used to look up artifacts in the remote repository.


resolver

@Component
protected ArtifactResolver resolver
Artifact resolver used to resolve artifacts.


localRepo

@Parameter(property="localRepository",
           readonly=true,
           required=true)
protected ArtifactRepository localRepo
Location of the local repository.


remoteRepos

@Parameter(property="project.remoteArtifactRepositories",
           readonly=true,
           required=true)
protected List<?> remoteRepos
List of Remote Repositories used by the resolver

Constructor Detail

AbstractSBTCompileMojo

public AbstractSBTCompileMojo()
Method Detail

execute

public void execute()
             throws MojoExecutionException,
                    MojoFailureException
Performs compilation.

Throws:
MojoExecutionException - if an unexpected problem occurs. Throwing this exception causes a "BUILD ERROR" message to be displayed.
MojoFailureException - if an expected problem (such as a compilation failure) occurs. Throwing this exception causes a "BUILD FAILURE" message to be displayed.

internalExecute

protected void internalExecute()
                        throws MojoExecutionException,
                               MojoFailureException,
                               IOException
Actual compilation code, to be overridden.

Throws:
MojoExecutionException - if an unexpected problem occurs.
MojoFailureException - if an expected problem (such as a compilation failure) occurs.
IOException - if an IO exception occurs.

getClasspathElements

protected abstract List<String> getClasspathElements()
Returns compilation classpath elements.

Returns:
classpath elements

getCompileSourceRoots

protected abstract List<String> getCompileSourceRoots()
Returns compilation source roots.

Returns:
source roots

getSourceIncludes

protected abstract Set<String> getSourceIncludes()
A list of inclusion filters for the compiler.

Returns:
inclusion filters

getSourceExcludes

protected abstract Set<String> getSourceExcludes()
A list of exclusion filters for the compiler.

Returns:
exclusion filters

getOutputDirectory

protected abstract File getOutputDirectory()
Returns output directory.

Returns:
output directory

getAnalysisCacheFile

protected abstract File getAnalysisCacheFile()
Returns incremental compilation analysis cache file.

Returns:
analysis cache file

getAnalysisCacheMap

protected abstract Map<File,File> getAnalysisCacheMap()
Returns incremental compilation analyses map for reactor projects.

Returns:
analysis cache map

defaultAnalysisCacheFile

protected File defaultAnalysisCacheFile(MavenProject p)
Returns incremental main compilation analysis cache file location for a project.

Parameters:
p - Maven project
Returns:
analysis cache file location

defaultTestAnalysisCacheFile

protected File defaultTestAnalysisCacheFile(MavenProject p)
Returns incremental test compilation analysis cache file location for a project.

Parameters:
p - Maven project
Returns:
analysis cache file location


Copyright © 2013. All rights reserved.