Java version

Hi
We have troubles building our Scala projects using Java version you have on the machine. The solution was to update APT repositories to include latest JAVA from webupd8team. We don’t really install new java version we just update the repos and accept the license. Java version itself is not changed at all and then the build passes.
Here is what we do to solve this:
> java:

        version: oraclejdk8
    pre:
        - echo | sudo add-apt-repository ppa:webupd8team/java
        - sudo apt-get update
        - echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections

Is there another way for us or you can fix this on your side ?