Git Product home page Git Product logo

scala's Introduction

scala sbt manual 手册

一、下载scala

1. https://www.scala-lang.org/,两种方式一种是Scala IDE,一种是SBt,我选择后者https://www.scala-sbt.org/1.x/docs/Installing-sbt-on-Windows.html

2. 解压sbt-1.2.8,配置环境变量

3. 配置sbt工作目录和aliyun的ivy2仓库,在conf/sbtconfig.txt下面

-Dsbt.boot.directory=D:/scala/sbt-1.2.8/.sbt/boot -Dsbt.global.base=D:/scala/sbt-1.2.8/data/.sbt -Dsbt.ivy.home=D:/.ivy2 -Dsbt.repository.config=D:/scala/sbt-1.2.8/conf/repo.properties -Dsbt.repository.secure=false

4. 配置repo.properties

进入conf/repo.properties

Create the project

cd to an empty folder. Run the following command sbt new scala/hello-world.g8. This pulls the ‘hello-world’ template from GitHub. It will also create a target folder, which you can ignore. When prompted, name the application hello-world. This will create a project called “hello-world”. Let’s take a look at what just got generated:

  • hello-world
    • project (sbt uses this to install manage plugins and dependencies)
      • build.properties
    • src
      • main
        • scala (All of your scala code goes here) -Main.scala (Entry point of program) <-- this is all we need for now build.sbt (sbt's build definition file)

Running the project

cd into hello-world. Run sbt. This will open up the sbt console. Type ~run. The ~ is optional and causes sbt to re-run on every file save, allowing for a fast edit/run/debug cycle. sbt will also generate a target directory which you can ignore. Modifying the code Open the file src/main/scala/Main.scala in your favorite text editor. Change “Hello, World!” to “Hello, New York!” If you haven’t stopped the sbt command, you should see “Hello, New York!” printed to the console. You can continue to make changes and see the results in the console.

Adding a dependency

Open up build.sbt and add the following line: libraryDependencies += "org.scala-lang.modules" %% "scala-parser-combinators" % "1.1.0"

scala's People

Contributors

ziapple avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.