Class JavacCompiler
- java.lang.Object
-
- org.codehaus.plexus.logging.AbstractLogEnabled
-
- org.codehaus.plexus.compiler.AbstractCompiler
-
- org.codehaus.plexus.compiler.javac.JavacCompiler
-
- All Implemented Interfaces:
Compiler
,org.codehaus.plexus.logging.LogEnabled
@Component(role=Compiler.class, hint="javac ") public class JavacCompiler extends AbstractCompiler
- Author:
- Trygve Laugstøl, Matthew Pocock, Jörg Waßmer, Others
-
-
Field Summary
-
Fields inherited from class org.codehaus.plexus.compiler.AbstractCompiler
EOL, PS
-
-
Constructor Summary
Constructors Constructor Description JavacCompiler()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static String[]
buildCompilerArguments(CompilerConfiguration config, String[] sourceFiles)
protected CompilerResult
compileInProcessWithProperClassloader(Class<?> javacClass, String[] args)
protected CompilerResult
compileOutOfProcess(CompilerConfiguration config, String executable, String[] args)
Compile the java sources in a external process, calling an external executable, like javac.String[]
createCommandLine(CompilerConfiguration config)
Create the command line that would be executed using this configuration.protected Class<?>
createJavacClass()
Helper method for create Javac classprotected InProcessCompiler
inProcessCompiler()
protected static boolean
isJava16()
CompilerResult
performCompile(CompilerConfiguration config)
Performs the compilation of the project.-
Methods inherited from class org.codehaus.plexus.compiler.AbstractCompiler
canUpdateTarget, compile, getCompilerOutputStyle, getInputFileEnding, getOutputFile, getOutputFileEnding, getPathString, getSourceFiles, getSourceFilesForSourceRoot, makeClassName, toStringArray
-
-
-
-
Method Detail
-
performCompile
public CompilerResult performCompile(CompilerConfiguration config) throws CompilerException
Description copied from interface:Compiler
Performs the compilation of the project. Clients must implement this method.- Specified by:
performCompile
in interfaceCompiler
- Overrides:
performCompile
in classAbstractCompiler
- Parameters:
config
- the configuration description of the compilation to perform- Returns:
- the result of the compilation returned by the language processor
- Throws:
CompilerException
-
inProcessCompiler
protected InProcessCompiler inProcessCompiler()
-
isJava16
protected static boolean isJava16()
-
createCommandLine
public String[] createCommandLine(CompilerConfiguration config) throws CompilerException
Description copied from interface:Compiler
Create the command line that would be executed using this configuration. If this particular compiler has no concept of a command line then returns null.- Parameters:
config
- the CompilerConfiguration describing the compilation- Returns:
- an array of Strings that make up the command line, or null if this compiler has no concept of command line
- Throws:
CompilerException
- if there was an error generating the command line
-
buildCompilerArguments
public static String[] buildCompilerArguments(CompilerConfiguration config, String[] sourceFiles)
-
compileOutOfProcess
protected CompilerResult compileOutOfProcess(CompilerConfiguration config, String executable, String[] args) throws CompilerException
Compile the java sources in a external process, calling an external executable, like javac.- Parameters:
config
- compiler configurationexecutable
- name of the executable to launchargs
- arguments for the executable launched- Returns:
- a CompilerResult object encapsulating the result of the compilation and any compiler messages
- Throws:
CompilerException
-
compileInProcessWithProperClassloader
protected CompilerResult compileInProcessWithProperClassloader(Class<?> javacClass, String[] args) throws CompilerException
- Throws:
CompilerException
-
createJavacClass
protected Class<?> createJavacClass() throws CompilerException
Helper method for create Javac class- Throws:
CompilerException
-
-