Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Fixing the "Cannot Find Symbol" Error in Travis

DZone's Guide to

Fixing the "Cannot Find Symbol" Error in Travis

Travis and Shippable have problems building Java 1.8u45 code. There's a workaround for Travis.

· DevOps Zone ·
Free Resource

Discover how quick and easy it is to secure secrets, so you can get back to doing what you love. Try Conjur, a free open source security service for developers.

While building one of my repositories with Shippable, I got the following error:

[ERROR ] COMPILATION ERROR :
[INFO ] -------------------------------------------------------------
[ERROR ] /home /shippable /workspace /src /github. com /stevenschwenke /Java8Workshop /src /test /java /de /stevenschwenke /java /java8workshop /C_09_JavaFX. java : [ 193, 13 ] cannot find symbol
symbol : class Alert
location : class de. stevenschwenke. java. java8workshop. C_09_JavaFX
[ERROR ] /home /shippable /workspace /src /github. com /stevenschwenke /Java8Workshop /src /test /java /de /stevenschwenke /java /java8workshop /C_09_JavaFX. java : [ 193, 31 ] cannot find symbol
symbol : class Alert
location : class de. stevenschwenke. java. java8workshop. C_09_JavaFX
[ERROR ] /home /shippable /workspace /src /github. com /stevenschwenke /Java8Workshop /src /test /java /de /stevenschwenke /java /java8workshop /C_09_JavaFX. java : [ 193, 42 ] package Alert does not exist
[INFO ] 3 errors
[INFO ] -------------------------------------------------------------
[INFO ] ------------------------------------------------------------------------
[INFO ] BUILD FAILURE 


Solution for Travis

See Travis issue 4042. Adding the lines 10 to 13 into your .travis.yml seems to cause Travis to use a newer JDK version:

     addons:
    # language
    language: java

    # version numbers
    jdk:
    - oraclejdk8

    # Use JDK 8u45. The above line just causes the use of a minor version of Java 8.
    addons:
    apt:
    packages:
    - oracle-java8-installer 


That caused my build to run just fine in travis.

Solution for Shippable

Unfortunately, I don't know a solution for Shippable right now. However, you can view the progress in this bug report of mine.

TL;DR

Travis and Shippable have problems building Java 1.8u45 code. There's a workaround for Travis.

Conjur is a free open source security service built by DevOps engineers. With integrations with all your favorite tools and an easy way to secure secrets, it's a no brainer. Come check it out!

Topics:
travis ,travis ci ,travis-cl ,shippable code ,java 8 ,jdk ,java

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}