tycho-compiler:compile

Full name:

org.eclipse.tycho:tycho-compiler-plugin:5.0.0-SNAPSHOT:compile

Description:

Compiles application sources with eclipse plugin dependencies

Attributes:

  • Requires a Maven project to be executed.
  • Requires dependency resolution of artifacts in scope: compile.
  • The goal is thread-safe and supports parallel builds.
  • Binds by default to the lifecycle phase: compile.

Optional Parameters

Name Type Since Description
<annotationProcessors> String[] 0.16.0 Qualified class names of annotation processors to run. If specified, the normal processor discovery process will be skipped. This parameter requires a 1.6 VM or above and is used only if the compliance is 1.6
<compilerArgs> List<String> 0.17.0 Arguments to be passed to the compiler.
<compilerArgument> String -

Unformatted argument string to be passed to the compiler 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.

<compilerArguments> Map<String,String> -
Deprecated.
use copied.org.apache.maven.plugin.AbstractCompilerMojo.compilerArgs instead.

Arguments to be passed to the compiler (prepending a dash) 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.

<compilerId> String - The compiler id of the compiler to use.
Default: jdt
User Property: maven.compiler.compilerId
<compilerVersion> String - Version of the compiler to use, ex. "1.3", "1.5", if fork is set to true
User Property: maven.compiler.compilerVersion
<copyResources> boolean - Whether all resources in the source folders should be copied to ${project.build.outputDirectory}. true (default) means that all resources are copied from the source folders to ${project.build.outputDirectory}. false means that no resources are copied from the source folders to ${project.build.outputDirectory}. Set this to false in case you want to keep resources separate from java files in src/main/resources and handle them using maven-resources-plugin (e.g. for resource filtering.
Default: true
<debug> boolean - Whether to include debugging information in the compiled class files. The default value is true.
Default: true
User Property: maven.compiler.debug
<deriveReleaseCompilerArgumentFromTargetLevel> boolean - Whether the -release argument for the Java compiler should be derived from the target level. Enabled by default.

Disabling this can be useful in situations where compiling using -release cannot be used, e.g. when referencing internal JDK classes exported via an OSGI framework extension. In that case <release> should also be explicitly set to an empty value to prevent it from being inherited.


Default: true
<encoding> String - The -encoding argument for the Java compiler
User Property: project.build.sourceEncoding
<excludeResources> Set<String> - A list of exclusion filters for non-java resource files which should not be copied to the output directory.
<excludes> Set<String> - A list of exclusion filters for the compiler.
<executable> String - The executable of the compiler to use when fork is true.
User Property: maven.compiler.executable
<extraClasspathElements> Dependency[] - Transitively add specified maven artifacts to compile classpath in addition to elements calculated according to OSGi rules. All packages from additional entries will be accessible at compile time. Useful when OSGi runtime classpath contains elements not defined using normal dependency mechanisms. For example, when Eclipse Equinox is started from application server with -Dosgi.parentClassloader=fwk parameter.
<failOnWarning> boolean - Fail on warnings
Default: false
User Property: maven.compiler.failOnWarning
<fork> boolean - 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: false
<generatedSourcesDirectory> File 0.16.0 The directory where source files generated by annotation processors will be created. This parameter requires a 1.6 VM or above and is used only if the compliance is 1.6.
Default: ${project.build.directory}/generated-sources/annotations
<includes> Set<String> - A list of inclusion filters for the compiler.
<log> String - The format of the compiler log file. plain will log into a plain text file (.log), xml will log in xml format (.xml). If omitted, no logging into files is done. The log file name is derived from the jar file name:
Example:
build.properties:

output.lib1/library.jar = lib1bin/ 
output.lib2/library.jar = lib2bin/ 
output.. = bin/

And a configuration:

<configuration>
  <logDirectory>${project.build.directory}/logfiles</logDirectory>
  <log>xml</log> 
</configuration>

Will produce the following log files

${project.build.directory}/logfiles/@dot.xml
${project.build.directory}/logfiles/lib1_library.jar.xml
${project.build.directory}/logfiles/lib2_library.jar.xml
<logDirectory> File - The directory where the compiler log files should be placed. For each output jar a log file will be created and stored in this directory. Logging into files is only enabled if log is specified. Default: ${project.build.directory}/compile-logs
Default: ${project.build.directory}/compile-logs
<maxmem> String - maximum size, in megabytes, of the memory allocation pool, ex. "128", "128m" if fork is set to true
User Property: maven.compiler.maxmem
<meminitial> String - Initial size, in megabytes, of the memory allocation pool, ex. "64", "64m" if fork is set to true
User Property: maven.compiler.meminitial
<optimize> boolean - Optimize compiled code using the compiler's optimization methods
Default: false
User Property: maven.compiler.optimize
<outputFileName> String - Used to control the name of the output file when compiling a set of sources to a single file.
User Property: project.build.finalName
<pomOnlyDependencies> PomDependencies - Controls how additional pom dependencies are handled that are not used in the dependency computation of the bundle. This can be used to have compile only dependencies, e.g. annotations that are only have class or source retention. Possible values are:
  • consider (default) - pom dependencies not used already are added to the compile class path
  • ignore - pom dependencies not used already are ignored
  • wrapAsBundle - currently not used (but for future enhancements) treated as if 'consider' was given

Default: consider
<proc> String 0.16.0 If only is specified, the annotation processors will run but no compilation will be performed. If none is specified, annotation processors will not be discovered or run; compilation will proceed as if no annotation processors were found. By default the compiler must search the classpath for annotation processors, so specifying none may speed compilation if annotation processing is not required. This parameter requires a 1.6 VM or above and is used only if the compliance is 1.6
<release> String - The -release argument for the Java compiler
User Property: maven.compiler.release
<requireJavaPackageImports> boolean - Since OSGi R7 it is allowed to import java.* packages as well and considered good practice. This option controls if Tycho enforces this rule.
Default: false
<showDeprecation> boolean - Output source locations where deprecated APIs are used
Default: false
User Property: maven.compiler.showDeprecation
<showWarnings> boolean - Output warnings
Default: false
User Property: maven.compiler.showWarnings
<source> String - The -source argument for the Java compiler
User Property: maven.compiler.source
<staleMillis> int - The granularity in milliseconds of the last modification date for testing whether a source needs recompilation
Default: 0
User Property: lastModGranularityMs
<strictCompilerTarget> boolean - If set to false (the default) issue a warning if effective compiler target level is incompatible with bundle minimal execution environment. If set to true will fail the build if effective compiler target and minimal BREE are incompatible.
Default: false
<target> String - The -target argument for the Java compiler
User Property: maven.compiler.target
<useJDK> ToolchainProvider$JDKUsage - Which JDK to use for compilation. Default value is SYSTEM which means the currently running JDK. If BREE is specified, MANIFEST header Bundle-RequiredExecutionEnvironment is used to define the JDK to compile against. In this case, you need to provide a toolchains.xml configuration file. The value of BREE will be matched against the id of the JDK toolchain elements in toolchains.xml. If the BREEs version is 9 or later and the ID did not match any element, the version of the BREE will be matched against the version of the JDK toolchain elements. Example:
<toolchains>
  <toolchain>
     <type>jdk</type>
     <provides>
         <id>JavaSE-11</id>
         <version>11</version>
     </provides>
     <configuration>
        <jdkHome>/path/to/jdk/11</jdkHome>
     </configuration>
  </toolchain>
</toolchains>
The default value of the bootclasspath used for compilation is <jdkHome>/lib/*;<jdkHome>/lib/ext/*;<jdkHome>/lib/endorsed/* . For JDKs with different filesystem layouts, the bootclasspath can be specified explicitly in the configuration section. Example:
<configuration>
  <jdkHome>/path/to/jdk/1.5</jdkHome>
  <bootClassPath>
    <includes>
      <include>jre/lib/amd64/default/jclSC160/*.jar</include>
    </includes>
    <excludes>
      <exclude>**/alt-*.jar</exclude>
    </excludes>
  </bootClassPath>
</configuration>

Default: SYSTEM
<useProjectSettings> boolean - If set to true, the settings file ${project.basedir}/.settings/org.eclipse.jdt.core.prefs will be passed to the compiler. If the file is not present, the build will not fail.
Default: true
<verbose> boolean - Whether to output messages about what the compiler is doing
Default: false
User Property: maven.compiler.verbose

Parameter Details

<annotationProcessors>

Qualified class names of annotation processors to run. If specified, the normal processor discovery process will be skipped. This parameter requires a 1.6 VM or above and is used only if the compliance is 1.6
  • Type: java.lang.String[]
  • Since: 0.16.0
  • Required: No

<compilerArgs>

Arguments to be passed to the compiler.
  • Type: java.util.List<java.lang.String>
  • Since: 0.17.0
  • Required: No

<compilerArgument>

Unformatted argument string to be passed to the compiler 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.

  • Type: java.lang.String
  • Required: No

<compilerArguments>

Deprecated.
use copied.org.apache.maven.plugin.AbstractCompilerMojo.compilerArgs instead.

Arguments to be passed to the compiler (prepending a dash) 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.

  • Type: java.util.Map<java.lang.String, java.lang.String>
  • Required: No

<compilerId>

The compiler id of the compiler to use.
  • Type: java.lang.String
  • Required: No
  • User Property: maven.compiler.compilerId
  • Default: jdt

<compilerVersion>

Version of the compiler to use, ex. "1.3", "1.5", if fork is set to true
  • Type: java.lang.String
  • Required: No
  • User Property: maven.compiler.compilerVersion

<copyResources>

Whether all resources in the source folders should be copied to ${project.build.outputDirectory}. true (default) means that all resources are copied from the source folders to ${project.build.outputDirectory}. false means that no resources are copied from the source folders to ${project.build.outputDirectory}. Set this to false in case you want to keep resources separate from java files in src/main/resources and handle them using maven-resources-plugin (e.g. for resource filtering.
  • Type: boolean
  • Required: No
  • Default: true

<debug>

Whether to include debugging information in the compiled class files. The default value is true.
  • Type: boolean
  • Required: No
  • User Property: maven.compiler.debug
  • Default: true

<deriveReleaseCompilerArgumentFromTargetLevel>

Whether the -release argument for the Java compiler should be derived from the target level. Enabled by default.

Disabling this can be useful in situations where compiling using -release cannot be used, e.g. when referencing internal JDK classes exported via an OSGI framework extension. In that case <release> should also be explicitly set to an empty value to prevent it from being inherited.

  • Type: boolean
  • Required: No
  • Default: true

<encoding>

The -encoding argument for the Java compiler
  • Type: java.lang.String
  • Required: No
  • User Property: project.build.sourceEncoding

<excludeResources>

A list of exclusion filters for non-java resource files which should not be copied to the output directory.
  • Type: java.util.Set<java.lang.String>
  • Required: No

<excludes>

A list of exclusion filters for the compiler.
  • Type: java.util.Set<java.lang.String>
  • Required: No

<executable>

The executable of the compiler to use when fork is true.
  • Type: java.lang.String
  • Required: No
  • User Property: maven.compiler.executable

<extraClasspathElements>

Transitively add specified maven artifacts to compile classpath in addition to elements calculated according to OSGi rules. All packages from additional entries will be accessible at compile time. Useful when OSGi runtime classpath contains elements not defined using normal dependency mechanisms. For example, when Eclipse Equinox is started from application server with -Dosgi.parentClassloader=fwk parameter.
  • Type: org.apache.maven.model.Dependency[]
  • Required: No

<failOnWarning>

Fail on warnings
  • Type: boolean
  • Required: No
  • User Property: maven.compiler.failOnWarning
  • Default: false

<fork>

Allows running the compiler in a separate process. If "false" it uses the built in compiler, while if "true" it will use an executable.
  • Type: boolean
  • Required: No
  • Default: false

<generatedSourcesDirectory>

The directory where source files generated by annotation processors will be created. This parameter requires a 1.6 VM or above and is used only if the compliance is 1.6.
  • Type: java.io.File
  • Since: 0.16.0
  • Required: No
  • Default: ${project.build.directory}/generated-sources/annotations

<includes>

A list of inclusion filters for the compiler.
  • Type: java.util.Set<java.lang.String>
  • Required: No

<log>

The format of the compiler log file. plain will log into a plain text file (.log), xml will log in xml format (.xml). If omitted, no logging into files is done. The log file name is derived from the jar file name:
Example:
build.properties:

output.lib1/library.jar = lib1bin/ 
output.lib2/library.jar = lib2bin/ 
output.. = bin/

And a configuration:

<configuration>
  <logDirectory>${project.build.directory}/logfiles</logDirectory>
  <log>xml</log> 
</configuration>

Will produce the following log files

${project.build.directory}/logfiles/@dot.xml
${project.build.directory}/logfiles/lib1_library.jar.xml
${project.build.directory}/logfiles/lib2_library.jar.xml
  • Type: java.lang.String
  • Required: No

<logDirectory>

The directory where the compiler log files should be placed. For each output jar a log file will be created and stored in this directory. Logging into files is only enabled if log is specified. Default: ${project.build.directory}/compile-logs
  • Type: java.io.File
  • Required: No
  • Default: ${project.build.directory}/compile-logs

<maxmem>

maximum size, in megabytes, of the memory allocation pool, ex. "128", "128m" if fork is set to true
  • Type: java.lang.String
  • Required: No
  • User Property: maven.compiler.maxmem

<meminitial>

Initial size, in megabytes, of the memory allocation pool, ex. "64", "64m" if fork is set to true
  • Type: java.lang.String
  • Required: No
  • User Property: maven.compiler.meminitial

<optimize>

Optimize compiled code using the compiler's optimization methods
  • Type: boolean
  • Required: No
  • User Property: maven.compiler.optimize
  • Default: false

<outputFileName>

Used to control the name of the output file when compiling a set of sources to a single file.
  • Type: java.lang.String
  • Required: No
  • User Property: project.build.finalName

<pomOnlyDependencies>

Controls how additional pom dependencies are handled that are not used in the dependency computation of the bundle. This can be used to have compile only dependencies, e.g. annotations that are only have class or source retention. Possible values are:
  • consider (default) - pom dependencies not used already are added to the compile class path
  • ignore - pom dependencies not used already are ignored
  • wrapAsBundle - currently not used (but for future enhancements) treated as if 'consider' was given
  • Type: org.eclipse.tycho.core.resolver.shared.PomDependencies
  • Required: No
  • Default: consider

<proc>

If only is specified, the annotation processors will run but no compilation will be performed. If none is specified, annotation processors will not be discovered or run; compilation will proceed as if no annotation processors were found. By default the compiler must search the classpath for annotation processors, so specifying none may speed compilation if annotation processing is not required. This parameter requires a 1.6 VM or above and is used only if the compliance is 1.6
  • Type: java.lang.String
  • Since: 0.16.0
  • Required: No

<release>

The -release argument for the Java compiler
  • Type: java.lang.String
  • Required: No
  • User Property: maven.compiler.release

<requireJavaPackageImports>

Since OSGi R7 it is allowed to import java.* packages as well and considered good practice. This option controls if Tycho enforces this rule.
  • Type: boolean
  • Required: No
  • Default: false

<showDeprecation>

Output source locations where deprecated APIs are used
  • Type: boolean
  • Required: No
  • User Property: maven.compiler.showDeprecation
  • Default: false

<showWarnings>

Output warnings
  • Type: boolean
  • Required: No
  • User Property: maven.compiler.showWarnings
  • Default: false

<source>

The -source argument for the Java compiler
  • Type: java.lang.String
  • Required: No
  • User Property: maven.compiler.source

<staleMillis>

The granularity in milliseconds of the last modification date for testing whether a source needs recompilation
  • Type: int
  • Required: No
  • User Property: lastModGranularityMs
  • Default: 0

<strictCompilerTarget>

If set to false (the default) issue a warning if effective compiler target level is incompatible with bundle minimal execution environment. If set to true will fail the build if effective compiler target and minimal BREE are incompatible.
  • Type: boolean
  • Required: No
  • Default: false

<target>

The -target argument for the Java compiler
  • Type: java.lang.String
  • Required: No
  • User Property: maven.compiler.target

<useJDK>

Which JDK to use for compilation. Default value is SYSTEM which means the currently running JDK. If BREE is specified, MANIFEST header Bundle-RequiredExecutionEnvironment is used to define the JDK to compile against. In this case, you need to provide a toolchains.xml configuration file. The value of BREE will be matched against the id of the JDK toolchain elements in toolchains.xml. If the BREEs version is 9 or later and the ID did not match any element, the version of the BREE will be matched against the version of the JDK toolchain elements. Example:
<toolchains>
  <toolchain>
     <type>jdk</type>
     <provides>
         <id>JavaSE-11</id>
         <version>11</version>
     </provides>
     <configuration>
        <jdkHome>/path/to/jdk/11</jdkHome>
     </configuration>
  </toolchain>
</toolchains>
The default value of the bootclasspath used for compilation is <jdkHome>/lib/*;<jdkHome>/lib/ext/*;<jdkHome>/lib/endorsed/* . For JDKs with different filesystem layouts, the bootclasspath can be specified explicitly in the configuration section. Example:
<configuration>
  <jdkHome>/path/to/jdk/1.5</jdkHome>
  <bootClassPath>
    <includes>
      <include>jre/lib/amd64/default/jclSC160/*.jar</include>
    </includes>
    <excludes>
      <exclude>**/alt-*.jar</exclude>
    </excludes>
  </bootClassPath>
</configuration>
  • Type: org.eclipse.tycho.core.maven.ToolchainProvider$JDKUsage
  • Required: No
  • Default: SYSTEM

<useProjectSettings>

If set to true, the settings file ${project.basedir}/.settings/org.eclipse.jdt.core.prefs will be passed to the compiler. If the file is not present, the build will not fail.
  • Type: boolean
  • Required: No
  • Default: true

<verbose>

Whether to output messages about what the compiler is doing
  • Type: boolean
  • Required: No
  • User Property: maven.compiler.verbose
  • Default: false