Apache Maven Compiler Plugin compiler-compile()

  本篇文章为你整理了Apache Maven Compiler Plugin – compiler:compile()的详细内容,包含有 Apache Maven Compiler Plugin – compiler:compile,希望能帮助你了解 Apache Maven Compiler Plugin – compiler:compile。

  Classpath elements to supply as annotation processor path. If specified, the compiler will detect annotation processors only in those classpath elements. If omitted, the default classpath is used to detect annotation processors. The detection itself depends on the configuration of annotationProcessors.

  Each classpath element is specified using their Maven coordinates (groupId, artifactId, version, classifier, type). Transitive dependencies are added automatically. Exclusions are supported as well. Example:

  
Names of annotation processors to run. Only applies to JDK 1.6+ If not set, the default annotation processors discovery process applies.

  
 

  
Note that -J options are only passed through if fork is set to true.

   Example:

  
Sets the unformatted single argument string to be passed to the compiler. To pass multiple arguments such as -Xmaxerrs 1000 (which are actually two arguments) you have to use compilerArguments.

  This is because the list of valid arguments passed to a Java compiler varies based on the compiler version.

  Note that -J options are only passed through if fork is set to true.

  
 

  
Deprecated.

  Sets the arguments to be passed to the compiler (prepending a dash).

  This is because the list of valid arguments passed to a Java compiler varies based on the compiler version.

  Note that -J options are only passed through if fork is set to true.

  To pass -Xmaxerrs 1000 -Xlint -Xlint:-path -Averbose=true you should include the following:

  
The compiler id of the compiler to use. See this guide for more information.
Default value is: javac.
User property is: maven.compiler.compilerId.
 

  
reuseCreated (default): will reuse already created but in case of multi-threaded builds, each thread will have its own instance

  reuseSame: the same Javacc class will be used for each compilation even for multi-threaded build

  alwaysNew: a new Javacc class will be created for each compilation

   Note this parameter value depends on the os/jdk you are using, but the default value should work on most of env.
Default value is: ${reuseCreated}.
User property is: maven.compiler.compilerReuseStrategy.
 

  
Version of the compiler to use, ex. 1.3 , 1.5 , if fork is set to true.
User property is: maven.compiler.compilerVersion.
 

  
Package info source files that only contain javadoc and no annotation on the package can lead to no class file being generated by the compiler. This causes a file miss on the next compilations and forces an unnecessary recompilation. The default value of true causes an empty class file to be generated. This behavior can be changed by setting this parameter to false.
Default value is: true.
User property is: maven.compiler.createMissingPackageInfoClass.
 

  
Set to true to include debugging information in the compiled class files.
Default value is: true.
User property is: maven.compiler.debug.
 

  
when forking and debug activated the commandline used will be dumped in this file
Default value is: javac.
 

  
Keyword list to be appended to the -g command-line switch. Legal values are none or a comma-separated list of the following keywords: lines, vars, and source. If debug level is not specified, by default, nothing will be appended to -g. If debug is not turned on, this attribute will be ignored.
User property is: maven.compiler.debuglevel.
 

  
Set to true to Enable preview language features of the java compiler
Default value is: false.
User property is: maven.compiler.enablePreview.
 

  
The -encoding argument for the Java compiler.
Default value is: ${project.build.sourceEncoding}.
User property is: encoding.
 

  
Sets the executable of the compiler to use when fork is true.
User property is: maven.compiler.executable.
 

  
Indicates whether the build will continue even if there are compilation errors.
Default value is: true.
User property is: maven.compiler.failOnError.
 

  
Indicates whether the build will continue even if there are compilation warnings.
Default value is: false.
User property is: maven.compiler.failOnWarning.
 

  
File extensions to check timestamp for incremental build. Default contains only class and jar.
 

  
compiler can now use javax.tools if available in your current jdk, you can disable this feature using -Dmaven.compiler.forceJavacCompilerUse=true or in the plugin configuration
Default value is: false.
User property is: maven.compiler.forceJavacCompilerUse.
 

  
Allows running the compiler in a separate process. If false it uses the built in compiler, while if true it will use an executable.
Default value is: false.
User property is: maven.compiler.fork.
 

  
Specify where to place generated source files created by annotation processing. Only applies to JDK 1.6+

  
Default value is: ${project.build.directory}/generated-sources/annotations.
 

  
Keyword to be appended to the -implicit: command-line switch.
User property is: maven.compiler.implicit.
 

  
Specify the requirements for this jdk toolchain for using a different javac than the one of the JRE used by Maven. This overrules the toolchain selected by the maven-toolchain-plugin.

   (see Guide to Toolchains for more info)

  
Sets the maximum size, in megabytes, of the memory allocation pool, ex. 128 , 128m if fork is set to true.
User property is: maven.compiler.maxmem.
 

  
Initial size, in megabytes, of the memory allocation pool, ex. 64 , 64m if fork is set to true.
User property is: maven.compiler.meminitial.
 

  
When set to true, the classes will be placed in META-INF/versions/${release} The release value must be set, otherwise the plugin will fail.

   Note: A jar is only a multirelease jar if META-INF/MANIFEST.MF contains Multi-Release: true. You need to set this by configuring the maven-jar-plugin. This implies that you cannot test a multirelease jar using the outputDirectory.
 

  
Deprecated. Set to true to optimize the compiled code using the compilers optimization methods.
Default value is: false.
User property is: maven.compiler.optimize.
 

  
Set to true to generate metadata for reflection on method parameters.
Default value is: false.
User property is: maven.compiler.parameters.
 

  
Sets whether annotation processing is performed or not. Only applies to JDK 1.6+ If not set, both compilation and annotation processing are performed at the same time.

  Allowed values are:

  
The -release argument for the Java compiler, supported since Java9
User property is: maven.compiler.release.
 

  
(no description)
Default value is: false.
User property is: maven.compiler.showCompilationChanges.
 

  
Sets whether to show source locations where deprecated APIs are used.
Default value is: false.
User property is: maven.compiler.showDeprecation.
 

  
Set to false to disable warnings during compilation.
Default value is: true.
User property is: maven.compiler.showWarnings.
 

  
Set this to true to bypass compilation of main sources. Its use is NOT RECOMMENDED, but quite convenient on occasion.
User property is: maven.main.skip.
 

  
(no description)
Default value is: false.
User property is: maven.compiler.skipMultiThreadWarning.
 

  
Since 3.11.0 the default value has changed from 1.7 to 1.8

  
Default value is: 1.8.
User property is: maven.compiler.source.
 

  
Sets the granularity in milliseconds of the last modification date for testing whether a source needs recompilation.
Default value is: 0.
User property is: lastModGranularityMs.
 

  
Since 3.11.0 the default value has changed from 1.7 to 1.8

  
Default value is: 1.8.
User property is: maven.compiler.target.
 

  
This leads to two different modes depending on the underlying compiler. The default javac compiler does the following:

  
true (default) in this mode the compiler plugin determines whether any JAR files the current module depends on have changed in the current build run; or any source file was added, removed or changed since the last compilation. If this is the case, the compiler plugin recompiles all sources.

  false (not recommended) this only compiles source files which are newer than their corresponding class files, namely which have changed since the last compilation. This does not recompile other classes which use the changed class, potentially leaving them with references to methods that no longer exist, leading to errors at runtime.

  
Default value is: true.
User property is: maven.compiler.useIncrementalCompilation.
 

  
Set to true to show messages about what the compiler is doing.
Default value is: false.
User property is: maven.compiler.verbose.
 

  
Classpath elements to supply as annotation processor path. If specified, the compiler will detect annotation processors only in those classpath elements. If omitted, the default classpath is used to detect annotation processors. The detection itself depends on the configuration of annotationProcessors.

  Each classpath element is specified using their Maven coordinates (groupId, artifactId, version, classifier, type). Transitive dependencies are added automatically. Exclusions are supported as well. Example:

  
Names of annotation processors to run. Only applies to JDK 1.6+ If not set, the default annotation processors discovery process applies.

  
Note that -J options are only passed through if fork is set to true.

   Example:

  
Sets the unformatted single argument string to be passed to the compiler. To pass multiple arguments such as -Xmaxerrs 1000 (which are actually two arguments) you have to use compilerArguments.

  This is because the list of valid arguments passed to a Java compiler varies based on the compiler version.

  Note that -J options are only passed through if fork is set to true.

  
This is because the list of valid arguments passed to a Java compiler varies based on the compiler version.

  Note that -J options are only passed through if fork is set to true.

  To pass -Xmaxerrs 1000 -Xlint -Xlint:-path -Averbose=true you should include the following:

  
The compiler id of the compiler to use. See this guide for more information.

  
reuseCreated (default): will reuse already created but in case of multi-threaded builds, each thread will have its own instance

  reuseSame: the same Javacc class will be used for each compilation even for multi-threaded build

  alwaysNew: a new Javacc class will be created for each compilation

   Note this parameter value depends on the os/jdk you are using, but the default value should work on most of env.

  
Version of the compiler to use, ex. 1.3 , 1.5 , if fork is set to true.

  
compileSourceRoots

  The source directories containing the sources to be compiled.

  
createMissingPackageInfoClass

  Package info source files that only contain javadoc and no annotation on the package can lead to no class file being generated by the compiler. This causes a file miss on the next compilations and forces an unnecessary recompilation. The default value of true causes an empty class file to be generated. This behavior can be changed by setting this parameter to false.

  
Keyword list to be appended to the -g command-line switch. Legal values are none or a comma-separated list of the following keywords: lines, vars, and source. If debug level is not specified, by default, nothing will be appended to -g. If debug is not turned on, this attribute will be ignored.

  
File extensions to check timestamp for incremental build. Default contains only class and jar.

  
forceJavacCompilerUse

  compiler can now use javax.tools if available in your current jdk, you can disable this feature using -Dmaven.compiler.forceJavacCompilerUse=true or in the plugin configuration

  
Allows running the compiler in a separate process. If false it uses the built in compiler, while if true it will use an executable.

  
Specify where to place generated source files created by annotation processing. Only applies to JDK 1.6+

  
incrementalExcludes

  A list of exclusion filters for the incremental calculation.

  
Specify the requirements for this jdk toolchain for using a different javac than the one of the JRE used by Maven. This overrules the toolchain selected by the maven-toolchain-plugin.

   (see Guide to Toolchains for more info)

  
Sets the maximum size, in megabytes, of the memory allocation pool, ex. 128 , 128m if fork is set to true.

  
Initial size, in megabytes, of the memory allocation pool, ex. 64 , 64m if fork is set to true.

  
When set to true, the classes will be placed in META-INF/versions/${release} The release value must be set, otherwise the plugin will fail.

   Note: A jar is only a multirelease jar if META-INF/MANIFEST.MF contains Multi-Release: true. You need to set this by configuring the maven-jar-plugin. This implies that you cannot test a multirelease jar using the outputDirectory.

  
Sets whether annotation processing is performed or not. Only applies to JDK 1.6+ If not set, both compilation and annotation processing are performed at the same time.

  Allowed values are:

  
Set this to true to bypass compilation of main sources. Its use is NOT RECOMMENDED, but quite convenient on occasion.

  
Sets the granularity in milliseconds of the last modification date for testing whether a source needs recompilation.

  
This leads to two different modes depending on the underlying compiler. The default javac compiler does the following:

  
true (default) in this mode the compiler plugin determines whether any JAR files the current module depends on have changed in the current build run; or any source file was added, removed or changed since the last compilation. If this is the case, the compiler plugin recompiles all sources.

  false (not recommended) this only compiles source files which are newer than their corresponding class files, namely which have changed since the last compilation. This does not recompile other classes which use the changed class, potentially leaving them with references to methods that no longer exist, leading to errors at runtime.

  以上就是Apache Maven Compiler Plugin – compiler:compile()的详细内容,想要了解更多 Apache Maven Compiler Plugin – compiler:compile的内容,请持续关注盛行IT软件开发工作室。

郑重声明:本文由网友发布,不代表盛行IT的观点,版权归原作者所有,仅为传播更多信息之目的,如有侵权请联系,我们将第一时间修改或删除,多谢。

留言与评论(共有 条评论)
   
验证码: