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

  • SEARCH
  • Home
  • 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 8995607
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:38:33+00:00 2026-06-15T23:38:33+00:00

I’m having a good time learning Scala, but I’m having the hardest time grasping

  • 0

I’m having a good time learning Scala, but I’m having the hardest time grasping how to set up a development environment.

In Ruby

  • File hierarchy

    my_app/
      |
      +-- Gemfile
      +-- app.rb
    
  • Gemfile

    source :rubygems
    gem "mechanize"
    
  • app.rb

    require "mechanize"
    agent = Mechanize.new
    page = agent.get("http://google.com")
    
  • Install dependencies and run it

    $ bundle install
    $ ruby app.rb
    

What’s the Scala equivalent with sbt?

I’m reading about sbt and how packages/imports/jar dependencies work in Java/Scala, but I can’t seem to filter out the bare bones necessities.

  • What’s the minimal file hierarchy to replicate the above with Scala?
  • Here’s the Java Mechanize lib available on Maven: http://search.maven.org/#search|ga|1|mechanize
  • Once you run sbt and download the Mechanize dependencies, how to you discern the necessary import statements you need to get this to work?

    val agent = new MechanizeAgent
    val page: HtmlDocument = agent.get("http://www.google.com")
    

I got the above working in Eclipse by manually importing the .jars and then importing packages from the libraries until the compiler/runtime errors stopped and the agent worked. But that experience was discouraging and I’ve come here to repent.

Intent of this question: The Java ecosystem/workflow is overwhelming to me as someone that’s used to Ruby’s effortless, IDEless workflow. I think a bare bones equivalent would give me a place to start building upon.

Ideally, I’d like to get Scala development working with just Vim and the command line before becoming dependent on Eclipse.

  • 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-15T23:38:33+00:00Added an answer on June 15, 2026 at 11:38 pm

    I’d like to go a step farther than ffk’s answer, do much more hand-holding, and actually provide the direct translation of the Ruby example to Scala + sbt.

    • File hierarchy

      Crawler/
        +- build.sbt
        +- src/
           +- main/
              +- scala/
                 +- Crawler.scala
      
    • build.sbt

      libraryDependencies += "com.gistlabs" % "mechanize" % "0.11.0"
      
    • Crawler.scala

      import com.gistlabs.mechanize.MechanizeAgent
      import com.gistlabs.mechanize.document.Document
      
      object Crawler extends App {
        val agent = new MechanizeAgent
        val page: Document = agent.get("http://google.com")
      }
      
    • Install dependencies and run it

      $ sbt run
      

    To make the project importable into Eclipse or IntelliJ, you need the sbteclipse-plugin or sbt-idea plugin. But rather than having to declare these plugins in every build.sbt for every new project, you can declare them in a global build.sbt:

    // in ~/.sbt/plugins/build.sbt
    addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.1.0")
    addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.2.0")
    

    Then, back in your Scala app’s root directory:

    $ sbt eclipse
    or
    $ gen-idea
    

    Afterwards, you should be able to open it in the respective IDE.

    Note: Whenever you add dependencies in your build.sbt, you’ll need to rerun the sbt eclipse/gen-idea command so the IDE can pick it up.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported
In my XML file chapters tag has more chapter tag.i need to display chapters
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this

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.