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 COMPILER_INTEGRATION_ARTIFACT_ID
          SBT incremental compile "artifactId".
static String COMPILER_INTERFACE_ARTIFACT_ID
          SBT compile interface "artifactId".
static String COMPILER_INTERFACE_CLASSIFIER
          SBT compile interface sources "classifier".
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.
static String SBT_GROUP_ID
          SBT artifacts "groupId".
static String SCALA_COMPILER_ARTIFACTID
          Scala compiler "artifactId".
static String SCALA_GROUPID
          Scala artifacts "groupId".
static String SCALA_LIBRARY_ARTIFACTID
          Scala library "artifactId".
protected  String scalacOptions
          Additional parameters for Scala compiler.
protected  String sourceEncoding
          The -encoding argument for Scala and Java compilers.
static String XSBTI_ARTIFACT_ID
          SBT interface "artifactId".
 
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()
          Perform 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  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

SCALA_GROUPID

public static final String SCALA_GROUPID
Scala artifacts "groupId".

See Also:
Constant Field Values

SCALA_LIBRARY_ARTIFACTID

public static final String SCALA_LIBRARY_ARTIFACTID
Scala library "artifactId".

See Also:
Constant Field Values

SCALA_COMPILER_ARTIFACTID

public static final String SCALA_COMPILER_ARTIFACTID
Scala compiler "artifactId".

See Also:
Constant Field Values

SBT_GROUP_ID

public static final String SBT_GROUP_ID
SBT artifacts "groupId".

See Also:
Constant Field Values

COMPILER_INTEGRATION_ARTIFACT_ID

public static final String COMPILER_INTEGRATION_ARTIFACT_ID
SBT incremental compile "artifactId".

See Also:
Constant Field Values

COMPILER_INTERFACE_ARTIFACT_ID

public static final String COMPILER_INTERFACE_ARTIFACT_ID
SBT compile interface "artifactId".

See Also:
Constant Field Values

COMPILER_INTERFACE_CLASSIFIER

public static final String COMPILER_INTERFACE_CLASSIFIER
SBT compile interface sources "classifier".

See Also:
Constant Field Values

XSBTI_ARTIFACT_ID

public static final String XSBTI_ARTIFACT_ID
SBT interface "artifactId".

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
Perform 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

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.