9

I am using sbt 1.2.6 to compile my project. In my local machine compilation runs fine, but when using travis-ci for testing, the compiler complains that value isBlank is not a member of String.

You can find the source code here https://github.com/LukeDS-it/webfleet-driver/blob/679dff9877ea1edd403dc6cd3d55a22d5fd5328f/server/src/main/scala/it/ldsoftware/webfleet/driver/services/v1/AggregateService.scala#L138

And the build report here https://travis-ci.com/LukeDS-it/webfleet-driver/builds/92441228

I have no more information to provide. My IDE says that everything is fine, and if I run compile or test in local everything works fine.

What am I missing?

Robin Green
  • 32,079
  • 16
  • 104
  • 187
Luca
  • 1,116
  • 2
  • 15
  • 24
  • 2
    It does not compile on my local machine either. I am getting the same error. I noticed, that you have two branches. `master` compiles, `aggregates` does not compile. Are you sure, that you compile `aggregates` on your local machine too ? – ygor Nov 24 '18 at 19:42
  • 3
    Btw. `optional.isDefined && optional.get.isEmpty` can be written as `optional.exists(_.isEmpty)`. See: https://stackoverflow.com/questions/24086493/check-if-a-string-is-blank-or-doesnt-exist-in-scala – ygor Nov 24 '18 at 19:49
  • Yes, I am working on that branch in local. Thanks for the suggestion about the option, I appreciate it, being somewhat new in Scala. I will try to do a clean build to see why this issue. – Luca Nov 24 '18 at 20:29
  • Yes, please try sbt clean and sbt compile. No way, that there is a isBlank method in your project. Do you import it to intellij? Is the code valid there too? Is it marked as an implicit conversion? – ygor Nov 24 '18 at 20:47
  • 2
    Okay I found out why it happens: it looks like I'm compiling against Java 11 on my machine, where that method has been introduced. Whereas on travis-ci the java version is lower. – Luca Nov 24 '18 at 23:00
  • 4
    You should create an answer yourself. This is useful. – ygor Nov 25 '18 at 00:38

1 Answers1

15

After a bit of digging, I had the idea of looking at the JavaDoc for isEmpty and found out that it says

since: 11

On my machine I was compiling against Java11, whereas on Travis the java version was lower.

Luca
  • 1,116
  • 2
  • 15
  • 24