[Scala] sbt assembly does not work




I test scala application on circleci.
I use sbt (build tool for Scala) assembly for build scala application.

On circleci 1.0 does work, On circleci 2.0 doesn’t work…

I got error “[error] File name too long”.
The Similar problem is http://stackoverflow.com/questions/28565837/filename-too-long-sbt
I add “-Xmax-classfile-name” option, but it doesn’t work.

My circle.yml is below

executorType: docker

  - image: ubuntu:latest

I test on my local docker on macos, It does work.

I think that this error is only cricleci 2.0.

The additional information is here.



Hi there,

Did you try -Xmax-classfile-name=242? If so, could you share a link to an example build? Either here or in a Direct Message to me?



Thanks for reply.

It’s private repository.
Circleci 2.0 ubuntu container execute user root, 1.0 is user ubuntu.
How to run ubuntu (normal user) in 2.0?

I tested example build.


As a member of the support team, I can view private builds on circleci.com, so you can share links to private builds with me or other members of our support team.

In 2.0, you run as the default user for the first Docker image you list in circle.yml. You can run as another user with the user key-value pair:

  - image: ubuntu:14.04
    user: ubuntu

However, it’s up to you to ensure the Docker image supports that user.


Thanks for your reply.

Ubuntu official image is not support user parameter.

Circle.yml image user parameter is docker run -u <user> ubuntu <command> ?

I’ll contact your support team,


Hey, I’m also running into this error, is there any solution? I’ve tried with both the ubuntu:16.04 image, and CircleCI’s default build image circleci/build-image:ubuntu-14.04-XL-922-9410082. Additionally, setting -Xmax-classfile-name doesn’t help.


-Xmax-classfile-name options doesn’t help too…
Now, I’m finding any solution…


This seems like a bug in scalac. The new containers have a file length limit of 242, while my dev machine’s limit is only 13 characters higher, 255. It feels unlikely that all these long named class files normally fit into 255, but not 242. My guess is that somewhere scalac has hard-coded a limit of 255 that class files get truncated to.


There definitely seems to be a bug somewhere, but I still haven’t found definitively where yet. For what it is worth, it seems like the bug is present in Docker containers.


Hello, I added sbt option -Xmax-classfile-name, It’s working!!!

    scalacOptions ++= Seq(
      "-encoding", "utf-8",
      "-Xmax-classfile-name", "242" <= add here

Thank you.

Useful tips and best practices when migrating to CircleCI 2.0