Alfresco/alfresco-sdk

Build AMP file fails with SDK 4.0 and OpenJDK 11

crimsonman2 opened this issue · 6 comments

[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request

When trying to build an APM in Alfresco SDK 4.0 AIO project using OpenJDK 11 build fails with an error: "An API incompatibility was encountered while executing org.apache.maven.plugins:maven-assembly-plugin:2.6:single: java.lang.ExceptionInInitializerError: null".

In the same time if I switch to Java 8 build succeeds.

See details in attached log file.
build.log

Expected Behavior

Build should succeed, AMP file generated.

Current Behavior

Build fails with an error: "An API incompatibility was encountered while executing org.apache.maven.plugins:maven-assembly-plugin:2.6:single: java.lang.ExceptionInInitializerError: null".

Possible Solution

Steps to Reproduce (for bugs)

  1. Generate AIO project using Alfresco SDK 4.0;
  2. Uncomment section with maven-assembly-plugin section responsible for AMP generation in root POM of the project;
  3. execute "mvn clean package"
  4. See results.

Context

Writing extensions using third party libs, also have a need to override static resources (i.e. favicon.ico). Recommendations from SDK manual says that in that case I have to use APM packaging and not JAR.

Your Environment

  • Alfresco SDK version used: 4.0
  • Alfresco version used: 6.1 Community
  • Output of command 'mvn -version': Apache Maven 3.5.4
  • Output of command 'java -version':
    openjdk version "11" 2018-09-25
    OpenJDK Runtime Environment 18.9 (build 11+28)
    OpenJDK 64-Bit Server VM 18.9 (build 11+28, mixed mode)

Additional information

Upgrading maven-assembly-plugin to version 3.1.1 fails as well but with another error: "maven-assembly-plugin:3.1.1:single: java.lang.NoSuchMethodError: org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream.addRawArchiveEntry(Lorg/apache/commons/compress/archivers/zip/ZipArchiveEntry;Ljava/io/InputStream;)V"

But, if comment-out alfresco-maven-plugin from maven-assembly-plugin dependencies and change format in amp.xml assembly descriptor to zip build completes successfully.

So I suppose there is something wrong with alfresco-maven-plugin. Have you tested AMPs assembly with Java 11 ?

Hey @crimsonman2 - Unfortunately I'm not able to reproduce this issue.
Could you please provide also the parent pom and the pom file of the failing module?

POMs.zip

Hi, attached POMs that you asked for.
Also have to mention that I've tried to update Maven to v3.6.2 with no result.
Stack traces for assembly plugin v.2.6 and 3.1.1 also attached
maven-assembly-plugin_2.6.log
maven-assembly-plugin_3.1.1.log

Eventually assembly succeeded, but only when I've removed <version> tag for maven-assembly-plugin in AIO parent POM.

Hey @crimsonman2,

I've checked the POM files and they should be fine.
Could you maybe also attache the descriptor file "src/main/assembly/amp.xml" from the "alfresco-platform"-module?
It looks like the error is occuring while reading this file.

Upgrading jdk from

$ java -version
openjdk version "11" 2018-09-25
OpenJDK Runtime Environment 18.9 (build 11+28)
OpenJDK 64-Bit Server VM 18.9 (build 11+28, mixed mode)

to

$ java -version
openjdk version "11.0.9.1" 2020-11-04
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.9.1+1)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.9.1+1, mixed mode)

solve the problem for me!