Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8556985
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T15:28:22+00:00 2026-06-11T15:28:22+00:00

I have an sbt plugin, that needs to get compiler AST’s from source files.

  • 0

I have an sbt plugin, that needs to get compiler AST’s from source files. I tried to create a new compiler with the following code:

val settings = new Settings
settings.usejavacp.value = true
val compiler = new tools.nsc.interactive.Global(settings, new StoreReporter())

But I get the following error:

java.lang.Error: typeConstructor inapplicable for <none>

It seems that it somehow clashes with sbt’s internal compiler.

So, is there a way to get AST’s for those files from inside sbt?

Or maybe it is possible to get them from sbt’s compiler directly? (that would be even better, since I would not need to recompile everything every time)

EDIT:

Seems that using tools.nsc.Global instead of “interactive” one does not throw an error, but I don’t know how to get ASTs from it.

EDIT:

Well, tools.nsc.Global fails with the same error when I try to compile some files 🙁

SBT FAQ states that I should use some “representative type” when initializing my compiler – settings.embeddedDefaults[MyType]. But I can’t figure out exactly what I should send to it. Can somebody help me with it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T15:28:23+00:00Added an answer on June 11, 2026 at 3:28 pm

    This line means to use the value of the java.class.path system property as the classpath for the compiler:

    settings.usejavacp.value = true
    

    In sbt, this is only going to include the launcher jar because that is all that is on the classpath when the jvm is initialized.
    The launcher jar has been processed with ProGuard, so it contains incomplete Scala classes and should never be on a compiler classpath.

    Instead, explicitly set the classpath according to your needs:

    settings.classpath.value = "some;classpath"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an sbt (0.11.2) plugin that needs to get a path to text
I'm trying to get SBT to build a project that could have more than
I have a build.sbt file in my project root.. all my source files live
I'd like to access the name of a SBT project that uses a plugin
I'm having problems running the scala-android plugin when running sbt from inside IntelliJ. When
I'm trying to instal sbt based project to local maven repository. I have tried
I have tried to install SBT on my macbook. When I run it, it
I have a project built with sbt 0.11. I'm trying to create a simple
I'm new to Scala & sbt, and I'm trying to compile a project that
I have a Scala project and I use Scala-Eclipse-Plugin along with sbt. So far

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.