public abstract class ScalaMojoSupport
extends org.apache.maven.plugin.AbstractMojo
| Modifier and Type | Field and Description |
|---|---|
protected String |
addJavacArgs
Alternative method for specifying javac arguments (when using incremental compiler).
|
protected String |
addScalacArgs
Additional parameter to use to call the main class
Using this parameter only from command line ("-DaddScalacArgs=arg1|arg2|arg3|..."), not from pom.xml.
|
protected String[] |
args
compiler additionnals arguments
|
protected boolean |
checkMultipleScalaVersions
Check if every dependencies use the same version of scala-library or scala.compat.version.
|
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>
|
boolean |
displayCmd
Display the command line called ?
|
protected String |
encoding
The -encoding argument for the Java compiler.
|
protected org.apache.maven.repository.RepositorySystem |
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 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[] |
javacArgs
Arguments for javac (when using incremental compiler).
|
protected boolean |
javacGenerateDebugSymbols
Whether to instruct javac to generate debug symbols (when using incremental compiler)
|
protected String[] |
jvmArgs
Jvm Arguments.
|
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 org.apache.maven.project.MavenProject |
project |
protected List<org.apache.maven.project.MavenProject> |
reactorProjects
Contains the full list of projects in the reactor.
|
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_COMPILER_ARTIFACTID |
static String |
SCALA_LIBRARY_ARTIFACTID |
protected String |
scalaClassName
className (FQN) of the scala tool to provide as
|
protected org.apache.maven.execution.MavenSession |
session
The Maven Session Object
|
protected String |
source
The -source argument for the Java compiler (when using incremental compiler).
|
protected String |
target
The -target argument for the Java compiler (when using incremental compiler).
|
protected org.apache.maven.toolchain.ToolchainManager |
toolchainManager
The toolchain manager to use.
|
protected boolean |
useCanonicalPath
Should use CanonicalPath to normalize path (true => getCanonicalPath, false => getAbsolutePath)
|
| Constructor and Description |
|---|
ScalaMojoSupport() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addCompilerPluginOptions(JavaMainCaller scalac)
Adds appropriate compiler plugins to the scalac command.
|
protected void |
addCompilerToClasspath(Set<String> classpath) |
protected void |
addLibraryToClasspath(Set<String> classpath) |
protected void |
addToClasspath(org.apache.maven.artifact.Artifact artifact,
Set<String> classpath,
boolean addDependencies) |
void |
addToClasspath(String groupId,
String artifactId,
String version,
Set<String> classpath) |
void |
addToClasspath(String groupId,
String artifactId,
String version,
Set<String> classpath,
boolean addDependencies) |
void |
addToClasspath(String groupId,
String artifactId,
String version,
String classifier,
Set<String> classpath,
boolean addDependencies)
added for classifier support.
|
protected void |
checkScalaVersion() |
protected abstract void |
doExecute() |
void |
execute() |
protected VersionNumber |
findScalaVersion() |
protected String |
findVersionFromDependencies(String groupId,
String artifactId) |
protected String |
findVersionFromPluginArtifacts(String groupId,
String artifactId) |
protected Set<org.apache.maven.artifact.Artifact> |
getAllDependencies(String groupId,
String artifactId,
String version) |
protected File |
getArtifactJar(String groupId,
String artifactId,
String version) |
protected File |
getArtifactJar(String groupId,
String artifactId,
String version,
String classifier) |
protected List<File> |
getCompilerDependencies() |
protected File |
getCompilerJar() |
protected List<String> |
getCompilerPluginOptions() |
protected List<org.apache.maven.model.Dependency> |
getDependencies() |
protected JavaMainCaller |
getEmptyScalaCommand(String mainClass) |
protected List<String> |
getJavacOptions() |
protected File |
getLibraryJar() |
protected File |
getPluginArtifactJar(String groupId,
String artifactId,
String version) |
protected File |
getPluginArtifactJar(String groupId,
String artifactId,
String version,
String classifier) |
protected JavaMainCaller |
getScalaCommand() |
protected List<String> |
getScalaOptions() |
String |
getScalaOrganization() |
protected boolean |
isJavaSupportedByCompiler() |
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.
|
public static final String SCALA_LIBRARY_ARTIFACTID
public static final String SCALA_COMPILER_ARTIFACTID
protected org.apache.maven.project.MavenProject project
protected org.apache.maven.execution.MavenSession session
protected List<org.apache.maven.project.MavenProject> reactorProjects
protected org.apache.maven.repository.RepositorySystem factory
protected org.apache.maven.artifact.resolver.ArtifactResolver resolver
protected org.apache.maven.artifact.repository.ArtifactRepository localRepo
protected List<?> remoteRepos
protected BasicArtifact[] dependencies
<dependencies>
<dependency>
<groupId>org.scala-tools</groupId>
<artifactId>scala-compiler-addon</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
protected BasicArtifact[] compilerPlugins
protected String[] jvmArgs
protected String[] args
protected String addScalacArgs
protected String scalaClassName
protected String[] javacArgs
protected boolean javacGenerateDebugSymbols
protected String addJavacArgs
protected String source
protected String target
protected String encoding
public boolean displayCmd
protected boolean fork
protected boolean forceUseArgFile
protected boolean checkMultipleScalaVersions
protected boolean failOnMultipleScalaVersions
protected boolean useCanonicalPath
protected org.apache.maven.project.MavenProjectBuilder mavenProjectBuilder
protected org.apache.maven.toolchain.ToolchainManager toolchainManager
public String getScalaOrganization()
protected Set<org.apache.maven.artifact.Artifact> resolveDependencyArtifacts(org.apache.maven.project.MavenProject theProject) throws Exception
theProject - The POM.org.apache.maven.artifact.resolver.ArtifactResolutionExceptionorg.apache.maven.artifact.resolver.ArtifactNotFoundExceptionorg.apache.maven.project.artifact.InvalidDependencyVersionExceptionExceptionprotected Set<org.apache.maven.artifact.Artifact> resolveArtifactDependencies(org.apache.maven.artifact.Artifact artifact) throws Exception
artifact - the artifact used to retrieve dependenciesorg.apache.maven.artifact.resolver.ArtifactResolutionExceptionorg.apache.maven.artifact.resolver.ArtifactNotFoundExceptionorg.apache.maven.project.ProjectBuildingExceptionorg.apache.maven.project.artifact.InvalidDependencyVersionExceptionExceptionpublic void addToClasspath(String groupId, String artifactId, String version, Set<String> classpath) throws Exception
Exceptionpublic void addToClasspath(String groupId, String artifactId, String version, Set<String> classpath, boolean addDependencies) throws Exception
Exceptionpublic void addToClasspath(String groupId, String artifactId, String version, String classifier, Set<String> classpath, boolean addDependencies) throws Exception
Exceptionprotected void addToClasspath(org.apache.maven.artifact.Artifact artifact,
Set<String> classpath,
boolean addDependencies)
throws Exception
Exceptionprotected void addCompilerToClasspath(Set<String> classpath) throws Exception
Exceptionprotected void addLibraryToClasspath(Set<String> classpath) throws Exception
Exceptionpublic void execute()
throws org.apache.maven.plugin.MojoExecutionException,
org.apache.maven.plugin.MojoFailureException
org.apache.maven.plugin.MojoExecutionExceptionorg.apache.maven.plugin.MojoFailureExceptionprotected List<org.apache.maven.model.Dependency> getDependencies()
protected VersionNumber findScalaVersion() throws Exception
Exceptionprotected String findVersionFromDependencies(String groupId, String artifactId) throws Exception
Exceptionprotected JavaMainCaller getScalaCommand() throws Exception
Exceptionprotected JavaMainCaller getEmptyScalaCommand(String mainClass) throws Exception
Exceptionprotected List<File> getCompilerDependencies() throws Exception
Exceptionprotected File getArtifactJar(String groupId, String artifactId, String version) throws Exception
Exceptionprotected File getArtifactJar(String groupId, String artifactId, String version, String classifier) throws Exception
Exceptionprotected Set<org.apache.maven.artifact.Artifact> getAllDependencies(String groupId, String artifactId, String version) throws Exception
Exceptionprotected boolean isJavaSupportedByCompiler()
throws Exception
Exceptionprotected void addCompilerPluginOptions(JavaMainCaller scalac) throws Exception
scalac - Exceptionprotected List<String> getCompilerPluginOptions() throws Exception
Exceptionprotected String findVersionFromPluginArtifacts(String groupId, String artifactId) throws Exception
Exceptionprotected File getPluginArtifactJar(String groupId, String artifactId, String version) throws Exception
ExceptionCopyright © 2012–2015. All rights reserved.