vmware-archive/runtimes

Update maven.compiler from Java 6 to Java 8 (runtime java1.8)

ivangfr opened this issue · 1 comments

Hi,

I have created a function using the runtime java1.8. In my code, I am using try-with-resources that is supported by Java 8.

However, when I deploy my function, the pod doesn't start. Watching it, that is its behaviour

get-books-694b7674f7-ps4kq                     0/1     Init:Error   0          73s
get-books-694b7674f7-ps4kq                     0/1     Init:1/2     1          74s
get-books-694b7674f7-ps4kq                     0/1     Init:Error   1          79s
get-books-694b7674f7-ps4kq                     0/1     Init:CrashLoopBackOff   1          90s
get-books-694b7674f7-ps4kq                     0/1     Init:1/2                2          90s
get-books-694b7674f7-ps4kq                     0/1     Init:Error              2          97s
get-books-694b7674f7-ps4kq                     0/1     Init:CrashLoopBackOff   2

Then, when I describe it, I get the following log whose ERROR is clearly "try-with-resources is not supported"

[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ function ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /kubeless/function/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.2:compile (default-compile) @ function ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 2 source files to /kubeless/function/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /kubeless/function/src/main/java/io/kubeless/BookResource.java:[85,17] try-with-resources is not supported in -source 1.6
  (use -source 7 or higher to enable try-with-resources)
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] kubeless ........................................... SUCCESS [  0.013 s]
[INFO] params ............................................. SUCCESS [ 59.696 s]
[INFO] function ........................................... FAILURE [  3.426 s]
[INFO] handler ............................................ SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE

Shouldn't we change this file (https://github.com/kubeless/runtimes/blob/master/stable/java/pom.xml), updating its maven.compiler from Java 6 to Java 8 (as the runtime used is java1.8)?

Thanks!

Hi @ivangfr,

Yes, we can update the Java runtime (it's been a long time since the last update). Maybe someone can dedicate some time to this?