1

Problem in short: Compiling Java 8 (Atlassian plugin) code and having issues with Java 9 compiled 3rd party libraries

I have faced this problem multiple times and have worked around by avoiding upgrading any 3rd party library or using older version of 3rd party libraries, but the main issue still remains. This time I need to upgrade com.google.code.gson:gson due to a vulnerability. The problem is that the newer version of gson is probably compiled using Java 9. So when I am trying to package my own plugin on Java 8, it fails throwing below error

[ERROR] Manifest company:name:version : Exception: 19
[ERROR] Manifest company:name:version : Invalid class file module-info.class (java.lang.ArrayIndexOutOfBoundsException: 19)
[ERROR] Error(s) found in manifest configuration
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 25.256 s
[INFO] Finished at: 2022-08-02T16:47:25-04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.atlassian.maven.plugins:maven-confluence-plugin:6.3.15:generate-manifest (default-generate-manifest) on project temp: Unable to execute mojo: Error(s) found in manifest configuration -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1]     http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Executing: /usr/local/Cellar/atlassian-plugin-sdk/8.2.7/libexec/apache-maven-3.5.4/bin/mvn  -gs /usr/local/Cellar/atlassian-plugin-sdk/8.2.7/libexec/apache-maven-3.5.4/conf/settings.xml dependency:tree -DoutputType=dot -DoutputFile=maven_dependency_tree.gv

Does anyone know what kind of approach should be taken to solve above kind of problem instead of restricting oneself to older versions of 3rd party libraries? And upgrading to a newer Java version isn't an option for current environment I am working on.

Saurabh Gupta
  • 363
  • 3
  • 6
  • 17
  • Are you fine with using the Java 9 version of the library if a newer JRE is available but falling back to the old version if running on Java 8? Because there is no way of running Java 9 code with Java 8. – dan1st Aug 02 '22 at 21:22
  • I am restricted to Java 8 version. Like for above problem, I am upgrading com.google.code.gson:gson 2.8.1 > 2.8.9. It's needed due to a vulnerability and because 2.8.9 is compiled on Java 9, it's throwing above error. Are there any options available other than stop using gson? – Saurabh Gupta Aug 02 '22 at 21:42
  • No, there are no other options except changing gson itself to work for Java 8. But Java 8 projects should be migrated to newer versions anyways. – dan1st Aug 02 '22 at 21:45
  • I also found the above mention gson version is supported with Java 7, I don't know why its failing with OSGI – Saurabh Gupta Aug 03 '22 at 20:39
  • You might be successful with filing an issue. – dan1st Aug 03 '22 at 20:42

0 Answers0