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 7176375
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T16:29:38+00:00 2026-05-28T16:29:38+00:00

I use SBT 0.11.0. It requires that all sources must be placed in: [project]/src/main/scala/

  • 0

I use SBT 0.11.0. It requires that all sources must be placed in:

[project]/src/main/scala/

However I want a custom package such as:

[project]/src/com/test/...

I can leave things as SBT requires, then specify in every source file the custom package:

package com.test

But I got some problems with Eclipse auto-features such as import statements, generating new classes… Eclipse always adds main.scala before com.test. Is there something I can do to solve this?

Edited

For example I have this:

[project]
  src
    main
      scala
        com
          test
            A.scala
              package com.test
              ...
            B.scala
              package com.test
              ...

In B, I use some functions of A, I type it, then press Ctrl+Shift+O to let Eclipse import A. Eclipse does this:

import main.scala.com.test.A

But in A I set package to com.test (not main.scala.com.test).

This is small example. But when I have many source files, I need to refactor my code, things will be harder…

  • 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-05-28T16:29:39+00:00Added an answer on May 28, 2026 at 4:29 pm

    You are confusing source folders and packages!

    sbt by convention uses the source folder src/main/scala for Scala code. Within this folder you can create whichever packages you want, e.g. a subfolder foo/bar with a file Baz.scala that contains the following code:

    package foo.bar
    
    object Baz {
      ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an SBT scala application that runs fine using sbt run. However, this
I am building a simple Scala project with SBT 0.11. All the code files
I just want to create a directory layout for my scala project with sbt
In a project that consists of Java-only sources with Scala tests and which is
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
I'm trying to use sbt to compile an Android Project made in Java, which
Is it possible, with SBT to use a flat directory structure for multimodules? That
I am using sbt for an Akka project. I want to redirect the output
I am following the video on this page http://zegoggl.es/2009/12/building-android-apps-in-scala-with-sbt.html which use SBT to create

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.