Maven compiler plugin compilation error



Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile on project client-java-api #795

Comments

lsafina commented Nov 12, 2019

Could you please help me with the following issue I got while executing mvn install:

Java version: 13, maven 3.6.2

The text was updated successfully, but these errors were encountered:

brendandburns commented Nov 13, 2019

Hrm,
I will try to reproduce this. It might be a Java 13 thing.

In the meantime, does an mvn clean fix the issue?

lsafina commented Nov 13, 2019

Yes, mvn clean itself returns BUILD SUCCESS .

brendandburns commented Nov 14, 2019

after a mvn clean does mvn install work?

lsafina commented Nov 14, 2019

brendandburns commented Nov 15, 2019

Ok, I will try to reproduce this.

brendandburns commented Nov 15, 2019

There definitely appear to be compilation problems with Java 13. For now, I would recommend using an earlier JDK (it compiles w/ Java 11 for example)

We’ll continue to try to figure out what’s going on here.

brendandburns commented Nov 15, 2019

@iocanel I’m seeing failures in compiling the generated code w/ Java 13:

The generated code looks like:

I’m not sure why the List isn’t getting the right templates, but something is definitely confused.

Have you tested sundr.io on java 13?

brendandburns commented Nov 15, 2019

iocanel commented Nov 21, 2019

@brendanburns: Just tried sundrio with OpenJDK 13.0.1. Other than some issues related to tests, I didn’t notice any other kind of issue.

iocanel commented Nov 21, 2019

To be more specific, the generated BuildFluent.java seems to be generated as expected.

To further troubleshoot this, I think that it might make sense to try and use the exact same version and flavour of JDK.

In my tests I am using sdkman and I am installing Java.Net , GrallVM and Amazon variants of JDK.

I’ve only witnesed issues once with OpenJ9 .

What is the exact version you are using?

lsafina commented Nov 24, 2019 •

I’m using oracle jdk with jenv with 2 configurations:

Strange but I got the same errors with the amazon jdk :

The same with sdkman with AdoptOpenJDK , so weird.

lsafina commented Nov 24, 2019

Allright, I’ve found my hero:

Still weird why it didn’t work for all the previous versions in my environment.

iocanel commented Nov 25, 2019

Ok, let me see how it works with these JDKs for me.

sec23206 commented Dec 18, 2019

I got exactly the same errors described at the top of this thread with OpenJDK 11.0.5 when using the instructions to build the JAR files (mvn package) with this configuration:

I see references to others successfully building it with this JDK version, but is the recommendation to drop to v10.x?

Note: when using the «mvn install» option, I’m getting this error:

sec23206 commented Dec 19, 2019

Update: I installed OpenJDK 10 and retried the instructions to create the JAR files . the original errors listed at the start of this thread no longer occur, but I’m still getting the the error about «No getter found for property»:

So this error occurs with both OpenJDK v10 and 11.

derekdennybrown commented Jan 6, 2020

I get this on a clean install both in MacOS. First encountered this with Catalina + JDK 13, then wiped my java/, re-cloned and build with JDK 11. Both failed with the above message. A subsequent mvn install failed with a different error (io.sundr.SundrException: No getter found for property: instance on class: io.kubernetes.client.openapi.models.V1ClusterRoleBindingListFluentImpl).

I was also able to reproduce on Linux with a fresh build using openjdk version «12.0.2» 2019-07-16.

On mac-os, mvn clean && mvn -T=1 install fails in a different way:
[ERROR] ../java/kubernetes/src/main/java/io/kubernetes/client/openapi/apis/AdmissionregistrationApi.java:63: error: attribute not supported in HTML5: summary
[ERROR]

iocanel commented Jan 8, 2020 •

FYI, I did some fixes in sundrio to better support flavors of JDK11 and JDK13 also added some circleci configuration so that pull requests are validated against JDK8, JDK11 and JDK13.

I will release later today!

EDIT: version 0.21.0 is on its way to central.

Источник

Maven compiler plugin compilation error

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

Optional Parameters

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. Example:

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

Sets the arguments to be passed to the compiler.

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

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.

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

Default value is: $/generated-sources/annotations.

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.

note: requires at least Maven 3.3.1

The -source argument for the Java compiler.

NOTE: Since 3.8.0 the default value has changed from 1.5 to 1.6. Since 3.9.0 the default value has changed from 1.6 to 1.7
Default value is: 1.7.
User property is: maven.compiler.source.

The -target argument for the Java compiler.

NOTE: Since 3.8.0 the default value has changed from 1.5 to 1.6. Since 3.9.0 the default value has changed from 1.6 to 1.7
Default value is: 1.7.
User property is: maven.compiler.target.

to enable/disable incremental compilation feature.

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.

Name Type Since Description
List 3.5
Map 2.0.1 Deprecated. use compilerArgs instead.
String 2.0 The compiler id of the compiler to use. See this guide for more information.
Default value is: javac.
User property is: maven.compiler.compilerId.
String 2.5 Strategy to re use javacc class created:
  • 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: $ .
User property is: maven.compiler.compilerReuseStrategy.

String 2.0 Version of the compiler to use, ex. "1.3", "1.5", if fork is set to true.
User property is: maven.compiler.compilerVersion.
boolean 3.10 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.
boolean 2.0 Set to true to include debugging information in the compiled class files.
Default value is: true.
User property is: maven.compiler.debug.
String 3.10.0 when forking and debug activated the commandline used will be dumped in this file
Default value is: javac.
String 2.1 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.
boolean 3.10.1 Set to true to Enable preview language features of the java compiler
Default value is: false.
User property is: maven.compiler.enablePreview.
String 2.1 The -encoding argument for the Java compiler.
Default value is: $ .
User property is: encoding.
Set 2.0 A list of exclusion filters for the compiler.
String 2.0 Sets the executable of the compiler to use when fork is true.
User property is: maven.compiler.executable.
boolean 2.0.2 Indicates whether the build will continue even if there are compilation errors.
Default value is: true.
User property is: maven.compiler.failOnError.
boolean 3.6 Indicates whether the build will continue even if there are compilation warnings.
Default value is: false.
User property is: maven.compiler.failOnWarning.
List 3.1 File extensions to check timestamp for incremental build. Default contains only class and jar.
boolean 3.0 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.
boolean 2.0 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.
File 2.2
Set 2.0 A list of inclusion filters for the compiler.
Map 3.6
String 2.0.1 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.
String 2.0.1 Initial size, in megabytes, of the memory allocation pool, ex. "64", "64m" if fork is set to true.
User property is: maven.compiler.meminitial.
boolean 3.7.1

When set to true, the classes will be placed in META-INF/versions/$ 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.

boolean 2.0 Deprecated. This property is a no-op in javac.
Default value is: false.
User property is: maven.compiler.optimize.
String 2.0 Sets the name of the output file when compiling a set of sources to a single file. expression="$"

boolean 3.6.2 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:

  • none - no annotation processing is performed.
  • only - only annotation processing is done, no compilation.

String 3.6 The -release argument for the Java compiler, supported since Java9
User property is: maven.compiler.release.
boolean 2.0 Sets whether to show source locations where deprecated APIs are used.
Default value is: false.
User property is: maven.compiler.showDeprecation.
boolean 2.0 Set to true to show compilation warnings.
Default value is: false.
User property is: maven.compiler.showWarnings.
boolean 2.0 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.
boolean 2.5 (no description)
Default value is: false.
User property is: maven.compiler.skipMultiThreadWarning.
String 2.0
int 2.0 Sets the granularity in milliseconds of the last modification date for testing whether a source needs recompilation.
Default value is: .
User property is: lastModGranularityMs.
String 2.0
boolean 3.1
boolean 2.0 Set to true to show messages about what the compiler is doing.
Default value is: false.
User property is: maven.compiler.verbose.

Parameter Details

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. Example:

  • Type: java.util.List
  • Since: 3.5
  • Required: No

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

  • Type: java.lang.String[]
  • Since: 2.2
  • Required: No

Sets the arguments to be passed to the compiler.

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

  • Type: java.util.List
  • Since: 3.1
  • Required: No

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.

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

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:

  • Type: java.util.Map
  • Since: 2.0.1
  • Required: No
  • Type: java.lang.String
  • Since: 2.0
  • Required: No
  • User Property: maven.compiler.compilerId
  • Default: javac
  • Type: java.lang.String
  • Since: 2.5
  • Required: No
  • User Property: maven.compiler.compilerReuseStrategy
  • Default: $
  • Type: java.lang.String
  • Since: 2.0
  • Required: No
  • User Property: maven.compiler.compilerVersion
  • Type: boolean
  • Since: 3.10
  • Required: No
  • User Property: maven.compiler.createMissingPackageInfoClass
  • Default: true
  • Type: boolean
  • Since: 2.0
  • Required: No
  • User Property: maven.compiler.debug
  • Default: true
  • Type: java.lang.String
  • Since: 3.10.0
  • Required: No
  • Default: javac
  • Type: java.lang.String
  • Since: 2.1
  • Required: No
  • User Property: maven.compiler.debuglevel
  • Type: boolean
  • Since: 3.10.1
  • Required: No
  • User Property: maven.compiler.enablePreview
  • Default: false
  • Type: java.lang.String
  • Since: 2.1
  • Required: No
  • User Property: encoding
  • Default: $
  • Type: java.util.Set
  • Since: 2.0
  • Required: No
  • Type: java.lang.String
  • Since: 2.0
  • Required: No
  • User Property: maven.compiler.executable
  • Type: boolean
  • Since: 2.0.2
  • Required: No
  • User Property: maven.compiler.failOnError
  • Default: true
  • Type: boolean
  • Since: 3.6
  • Required: No
  • User Property: maven.compiler.failOnWarning
  • Default: false
  • Type: java.util.List
  • Since: 3.1
  • Required: No
  • Type: boolean
  • Since: 3.0
  • Required: No
  • User Property: maven.compiler.forceJavacCompilerUse
  • Default: false
  • Type: boolean
  • Since: 2.0
  • Required: No
  • User Property: maven.compiler.fork
  • Default: false

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

  • Type: java.io.File
  • Since: 2.2
  • Required: No
  • Default: $/generated-sources/annotations
  • Type: java.util.Set
  • Since: 2.0
  • Required: No

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.

  • Type: java.util.Map
  • Since: 3.6
  • Required: No
  • Type: java.lang.String
  • Since: 2.0.1
  • Required: No
  • User Property: maven.compiler.maxmem
  • Type: java.lang.String
  • Since: 2.0.1
  • Required: No
  • User Property: maven.compiler.meminitial

When set to true, the classes will be placed in META-INF/versions/$ 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.

  • Type: boolean
  • Since: 3.7.1
  • Required: No
  • Type: boolean
  • Since: 2.0
  • Required: No
  • User Property: maven.compiler.optimize
  • Default: false
  • Type: java.lang.String
  • Since: 2.0
  • Required: No
  • Type: boolean
  • Since: 3.6.2
  • Required: No
  • User Property: maven.compiler.parameters
  • Default: false

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:

  • none - no annotation processing is performed.
  • only - only annotation processing is done, no compilation.
  • Type: java.lang.String
  • Since: 2.2
  • Required: No
  • Type: java.lang.String
  • Since: 3.6
  • Required: No
  • User Property: maven.compiler.release
  • Type: boolean
  • Since: 2.0
  • Required: No
  • User Property: maven.compiler.showDeprecation
  • Default: false
  • Type: boolean
  • Since: 2.0
  • Required: No
  • User Property: maven.compiler.showWarnings
  • Default: false
  • Type: boolean
  • Since: 2.0
  • Required: No
  • User Property: maven.main.skip
  • Type: boolean
  • Since: 2.5
  • Required: No
  • User Property: maven.compiler.skipMultiThreadWarning
  • Default: false

The -source argument for the Java compiler.

NOTE: Since 3.8.0 the default value has changed from 1.5 to 1.6. Since 3.9.0 the default value has changed from 1.6 to 1.7

  • Type: java.lang.String
  • Since: 2.0
  • Required: No
  • User Property: maven.compiler.source
  • Default: 1.7
  • Type: int
  • Since: 2.0
  • Required: No
  • User Property: lastModGranularityMs
  • Default:

The -target argument for the Java compiler.

NOTE: Since 3.8.0 the default value has changed from 1.5 to 1.6. Since 3.9.0 the default value has changed from 1.6 to 1.7

  • Type: java.lang.String
  • Since: 2.0
  • Required: No
  • User Property: maven.compiler.target
  • Default: 1.7

to enable/disable incremental compilation feature.

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.

Источник

Читайте также:  Driver load error occurred
Оцените статью
toolgir.ru
Adblock
detector