albanoj2 / dzone-json-serializer

19 stars 12 forks source link

Compilation failure since diamond operator and lambda expressions #1

Open PegX opened 6 years ago

PegX commented 6 years ago

Hi,

I encounter this problem when I am compiling serializer with mvn build.

[ERROR] COMPILATION ERROR : [INFO] ------------------------------------------------------------- [ERROR] /home/peng/Works/javaLanguages/dzone-json-serializer/src/main/java/com/dzone/albanoj2/examples/annotation/jsonserializer/JsonSerializer.java:[16,72] diamond operator is not supported in -source 1.5 (use -source 7 or higher to enable diamond operator) [ERROR] /home/peng/Works/javaLanguages/dzone-json-serializer/src/main/java/com/dzone/albanoj2/examples/annotation/jsonserializer/JsonSerializer.java:[35,36] lambda expressions are not supported in -source 1.5 (use -source 8 or higher to enable lambda expressions) [INFO] 2 errors [INFO] ------------------------------------------------------------- [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.089 s [INFO] Finished at: 2018-04-05T15:51:57+02:00 [INFO] Final Memory: 11M/290M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project json-serializer: Compilation failure: Compilation failure: [ERROR] /home/peng/Works/javaLanguages/dzone-json-serializer/src/main/java/com/dzone/albanoj2/examples/annotation/jsonserializer/JsonSerializer.java:[16,72] diamond operator is not supported in -source 1.5 [ERROR] (use -source 7 or higher to enable diamond operator) [ERROR] /home/peng/Works/javaLanguages/dzone-json-serializer/src/main/java/com/dzone/albanoj2/examples/annotation/jsonserializer/JsonSerializer.java:[35,36] lambda expressions are not supported in -source 1.5 [ERROR] (use -source 8 or higher to enable lambda expressions) [ERROR] -> [Help 1]

The environment likes the following description: Maven home: /usr/share/maven Java version: 1.8.0_162, vendor: Oracle Corporation Java home: /usr/lib/jvm/java-8-openjdk-amd64/jre Default locale: en_US, platform encoding: ISO-8859-1 OS name: "linux", version: "4.15.0-1-amd64", arch: "amd64", family: "unix"

I suppose there are some ways to indicate the -source 7 / -source 8. However, what should I do in order to solve this problem.

PegX commented 6 years ago

I solve this problem with inserting the following content in pom.xml file

    <properties>
        <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
    </properties>