Expand my Community achievements bar.

SOLVED

AEM | Cloud Manager Build Issue | Java 11

Avatar

Level 3

Hi,

 

Facing an issue while deploying my code through CLOUD manager with java 11. Getting below error. Any pointer?

 

 

494 [main] [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project ****.services: Fatal error compiling: invalid flag: --release -> [Help 1]

1 Accepted Solution

Avatar

Correct answer by
Community Advisor
2 Replies

Avatar

Correct answer by
Community Advisor

Please remove <release> tag from maven-compiler-plugin in pom.xml. It should help. 

Below are the links for similar issue with solution :

 

https://stackoverflow.com/questions/49105941/intellij-maven-project-fatal-error-compiling-invalid-fl...

https://exerror.com/compile-default-compile-on-project-spring-rest-fatal-error-compiling-invalid-fla...

 

Avatar

Level 3

Fix that solved our issue is done on top of this https://experienceleague.adobe.com/docs/experience-manager-cloud-service/content/implementing/using-....

 

Updates has been request in this document and will soon be available.

 

Changes are -

 

The [Maven Toolchains Plugin](https://maven.apache.org/plugins/maven-toolchains-plugin/) allows projects to select a specific JDK (or toolchain) to be used in the context of toolchains-aware Maven plugins. This is done in the project's `pom.xml` file by specifying a vendor and version value.

This toolchain plugin can be added as part of a profile as shown below.

 

<profile>
<id>cm-java-11</id>
<activation>
<property>
<name>env.CM_BUILD</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-toolchains-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<goals>
<goal>toolchain</goal>
</goals>
</execution>
</executions>
<configuration>
<toolchains>
<jdk>
<version>11</version>
<vendor>oracle</vendor>
</jdk>
</toolchains>
</configuration>
</plugin>
</plugins>
</build>
</profile>
```

This will cause all toolchains-aware Maven plugins to use the Oracle JDK, version 11.