Package scala_maven
Class ScalaCompilerSupport
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- scala_maven.ScalaMojoSupport
-
- scala_maven.ScalaSourceMojoSupport
-
- scala_maven.ScalaCompilerSupport
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled
,org.apache.maven.plugin.Mojo
- Direct Known Subclasses:
ScalaCompileMojo
,ScalaContinuousCompileMojo
,ScalaTestCompileMojo
public abstract class ScalaCompilerSupport extends ScalaSourceMojoSupport
Abstract parent of all Scala Mojo who run compilation
-
-
Field Summary
Fields Modifier and Type Field Description static String
ALL
static String
INCREMENTAL
static String
MODIFIED_ONLY
protected String
recompileMode
Recompile mode to use when sources were previously compiled and there is at least one change: "modified-only" => only modified sources are recompiled (pre 2.13 behavior), "all" => all sources are recompiled, "incremental" => incrementally recompile modified sources and other affected sources.-
Fields inherited from class scala_maven.ScalaSourceMojoSupport
excludes, includes, sendJavaToScalac
-
Fields inherited from class scala_maven.ScalaMojoSupport
addJavacArgs, addScalacArgs, args, checkMultipleScalaVersions, compilerPlugins, dependencies, displayCmd, encoding, factory, failOnMultipleScalaVersions, forceUseArgFile, fork, JAR, javacArgs, javacGenerateDebugSymbols, jvmArgs, localRepo, mavenProjectBuilder, POM, project, reactorProjects, remoteRepos, resolver, SCALA_COMPILER_ARTIFACTID, SCALA_LIBRARY_ARTIFACTID, scalaClassName, session, source, target, toolchainManager, useCanonicalPath
-
-
Constructor Summary
Constructors Constructor Description ScalaCompilerSupport()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
clearCompileErrors()
protected int
compile(List<File> sourceRootDirs, File outputDir, File analysisCacheFile, List<String> classpathElements, boolean compileInLoop)
protected File
defaultAnalysisCacheFile(org.apache.maven.project.MavenProject p)
protected File
defaultAnalysisDirectory(org.apache.maven.project.MavenProject p)
protected File
defaultTestAnalysisCacheFile(org.apache.maven.project.MavenProject p)
protected void
doExecute()
protected abstract File
getAnalysisCacheFile()
Analysis cache file for incremental recompilation.protected Map<File,File>
getAnalysisCacheMap()
protected abstract List<String>
getClasspathElements()
protected List<File>
getFilesToCompile(List<File> sourceRootDirs, long lastSuccessfullCompileTime)
protected abstract File
getOutputDir()
protected boolean
hasCompileErrors()
Returns true if the previous compile failedprotected int
incrementalCompile(List<String> classpathElements, List<File> sourceRootDirs, File outputDir, File cacheFile, boolean compileInLoop)
-
Methods inherited from class scala_maven.ScalaSourceMojoSupport
findSourceWithFilters, findSourceWithFilters, getSourceDirectories, initFilters, normalize
-
Methods inherited from class scala_maven.ScalaMojoSupport
addCompilerPluginOptions, addCompilerToClasspath, addLibraryToClasspath, addToClasspath, addToClasspath, addToClasspath, addToClasspath, checkScalaVersion, execute, findScalaVersion, findVersionFromDependencies, findVersionFromPluginArtifacts, getAllDependencies, getArtifactJar, getArtifactJar, getCompilerDependencies, getCompilerJar, getCompilerPluginOptions, getDependencies, getEmptyScalaCommand, getEmptyScalaCommand, getJavacOptions, getLibraryJar, getPluginArtifactJar, getPluginArtifactJar, getScalaCommand, getScalaCommand, getScalaOptions, getScalaOrganization, isJavaSupportedByCompiler, resolveArtifactDependencies, resolveDependencyArtifacts, resolveDependencyArtifacts, scalaCompilerArtifact
-
-
-
-
Field Detail
-
ALL
public static final String ALL
- See Also:
- Constant Field Values
-
MODIFIED_ONLY
public static final String MODIFIED_ONLY
- See Also:
- Constant Field Values
-
INCREMENTAL
public static final String INCREMENTAL
- See Also:
- Constant Field Values
-
recompileMode
@Parameter(property="recompileMode", defaultValue="all") protected String recompileMode
Recompile mode to use when sources were previously compiled and there is at least one change: "modified-only" => only modified sources are recompiled (pre 2.13 behavior), "all" => all sources are recompiled, "incremental" => incrementally recompile modified sources and other affected sources.
-
-
Method Detail
-
getClasspathElements
protected abstract List<String> getClasspathElements() throws Exception
- Throws:
Exception
-
getAnalysisCacheFile
protected abstract File getAnalysisCacheFile() throws Exception
Analysis cache file for incremental recompilation.- Throws:
Exception
-
doExecute
protected void doExecute() throws Exception
- Specified by:
doExecute
in classScalaMojoSupport
- Throws:
Exception
-
compile
protected int compile(List<File> sourceRootDirs, File outputDir, File analysisCacheFile, List<String> classpathElements, boolean compileInLoop) throws Exception, InterruptedException
- Throws:
Exception
InterruptedException
-
hasCompileErrors
protected boolean hasCompileErrors()
Returns true if the previous compile failed
-
clearCompileErrors
protected void clearCompileErrors()
-
getFilesToCompile
protected List<File> getFilesToCompile(List<File> sourceRootDirs, long lastSuccessfullCompileTime) throws Exception
- Throws:
Exception
-
incrementalCompile
protected int incrementalCompile(List<String> classpathElements, List<File> sourceRootDirs, File outputDir, File cacheFile, boolean compileInLoop) throws Exception, InterruptedException
- Throws:
Exception
InterruptedException
-
defaultAnalysisDirectory
protected File defaultAnalysisDirectory(org.apache.maven.project.MavenProject p)
-
defaultAnalysisCacheFile
protected File defaultAnalysisCacheFile(org.apache.maven.project.MavenProject p)
-
defaultTestAnalysisCacheFile
protected File defaultTestAnalysisCacheFile(org.apache.maven.project.MavenProject p)
-
-