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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:04:15+00:00 2026-05-23T20:04:15+00:00

I am trying to setup SBT to compile an existing project which does not

  • 0

I am trying to setup SBT to compile an existing project which does not use the maven directory structure. I am using the full configuration and have set my javaSource & resourceDirectory settings as follows:

def settings = Defaults.defaultSettings ++ Seq(
    resourceDirectory in Compile <<= baseDirectory( _ / "java" ),
    javaSource in Compile <<= baseDirectory( _ / "java" )
)

Now I want to be able to filter the resources we include in the jar artifact, as we currently do with ant, plus exclude .java files as our resources are mixed in with source code. For example:

<fileset dir="java" includes="**/*.txt, **/*.csv" excludes="**/*.java" />

Is there any way to do this?

  • 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-23T20:04:16+00:00Added an answer on May 23, 2026 at 8:04 pm

    Use defaultExcludes scoped for the unmanagedResources task and optionally the configuration. For example, this setting excludes .java files from the main resources:

    defaultExcludes in Compile in unmanagedResources := "*.java"
    

    in Compile restricts this setting to only apply to main resources. By using in Test instead, it would apply only to test resources. By omitting a configuration (that is, no in Compile or in Test), the setting would apply to both main and test resources.

    in unmanagedResources applies these excludes for resources only. To apply excludes to sources, for example, the scope would be in unmanagedSources. The reason for the unmanaged part is to emphasize that these apply to unmanaged (or manually edited) sources only.

    The defaultExcludes key has type sbt.FileFilter, so the setting value must be of this type. In the example above, "*.java" is implicitly converted to a FileFilter. * is interpreted as a wildcard and so the filter accepts files with a name that ends in ‘.java’. To combine filters, you use || and &&. For example, if .scala files needed to be excluded as well, the argument to := would be:

    "*.java" || "*.scala"
    

    In the original Ant fileset, the include and exclude filters select mutually exclusive sets of files, so only one is necessary.

    It is also possible to directly build the Seq[File] for unmanagedResources. For example:

    unmanagedResources in Compile <<=
      unmanagedResourceDirectories in Compile map { (dirs: Seq[File]) =>
        ( dirs ** ("*.txt" || "*.csv" -- "*.java") ).get
      }
    

    The ** method selects all descendents that match the FileFilter argument. You can verify that the files are selected as you expect by running show unmanaged-resources.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to setup a maven project such that I will be able
I am trying to setup an environment which would let me use a template
I'm trying setup a subset of boost and get it properly compiled using bjam,
I'm trying to setup an Apache/PHP/Postgresql server locally on my machine. I'm using Windows
I am trying to setup tracd for the project I am currently working on.
I'm trying to setup the Entity Framework with SQL Server 2008. I'm using Guids
Trying to setup a CodeIgniter based project for local development (LAMP stack), and once
Trying to setup my laptop to edit and run my C# application which called
trying to setup drupal's taxonomy module ( http://drupal.org/project/taxonomy_access ) to administer access to specific
Trying to setup a windows development machine for a Rails project that has a

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.