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

Download “The DevOps Journey - From Waterfall to Continuous Delivery” to learn learn about the importance of integrating automated testing into the DevOps workflow, brought to you in partnership with Sauce Labs.

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.

Discover how to optimize your DevOps workflows with our cloud-based automated testing infrastructure, brought to you in partnership with Sauce Labs

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

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

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

{{ parent.tldr }}

{{ parent.urlSource.name }}