Compiling with Java 8 in Bluemix

The devops service of Bluemix is nice but at this moment it uses java 7 by default. In order to compile to Java 8 we should modify the pom.xml so maven will try to use java8 when compiling (sames as this post in Japanese):
<project >
    ...

    <properties>
        ...
        <java.version>1.8</java.version>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
We should also modify the configuration of the build stage in the pipeline. We need to set JAVA_HOME so maven can find it (At first I tried to do set JBP_CONFIG_IBMJDK as adviced via the manifest.yaml but it didn't work).
# Set Java8
export JAVA_HOME=~/java8
export PATH="$JAVA_HOME/bin:$PATH"
Now we are ready to go :)

0 comments :

This work is licensed under BSD Zero Clause License | nacho4d ®