sbt in Action - Joshua Suereth, Matthew Farwell

sbt in Action

The simple Scala built tool
Buch | Softcover
325 Seiten
2015
Manning Publications (Verlag)
978-1-61729-127-2 (ISBN)
43,75 inkl. MwSt
Studibuch Logo

...gebraucht verfügbar!

  • Comprehensive and detailed guide
  • Fills in the gaps of information on sbt
  • Shows how to tame unwieldy complex builds
  • Master sbt's loosely coupled libraries
  • Effectively manage dependencies
  • Automate and simplify your builds
  • Customize builds and tasks

Simple Build Tool: sbt.
The idea of a high quality build tool for Scala is indeed simple, but sbt itself is richly-featured and powerful. Documentation for sbt is sparse, and the blogs, tutorials, and other bits scattered across the web demand a comprehensive, accurate picture of how to build Scala projects effectively and efficiently.

This book will help transform ugly, complex builds into a streamlined, automated, and repeatable process. SBT in Action is first and foremost a tutorial about effectively building Scala projects. It introduces the sbt tool with a simple project that establishes the fundamentals of running commands and tasks. Next, it shows how to use the peripheral libraries in sbt to make common tasks simpler.

This includes an I/O library to deal with files and how to parse user input in a meaningful fashion. Finally, it covers how to deploy software effectively.

This book assumes readers are comfortable reading and writing Scala code. No experience with sbt required.

ABOUT THE TECHNOLOGY
Known as the de-facto Scala build tool, sbt is used to build other pieces of software. It uses Scala as its lingua franca, which means that all settings and files are typesafe by default, providing a level of safety in builds that is uncommon.

Josh Suereth is a Senior Software Engineer at Typesafe and the author of Scala in Depth. He is the author of several open source Scala projects, including the Scala automated resource management library, the PGP sbt plugin.

Matthew Farwell is a Senior Software developer at Nexthink. He is the author of Scalastyle, the style checker for Scala and is a contributor to JUnit and the Eclipse Scala IDE.

preface
acknowledgments
about this book
author online
about the authors
about the cover illustration
Part 1 Why sbt?
1. Why sbt?
1.1. Why a build tool?
1.2. Apache Ant
1.3. Apache Maven
1.3.1. Build definition
1.3.2. Maven workflow-default lifecycle
1.3.3. Adding another task to a Maven build
1.3.4. Advantages of Maven
1.3.5. Limitations of Maven
1.4. Gradle
1.4.1. What is Gradle?
1.4.2. Gradle workflow
1.4.3. Adding another task to a Gradle build
1.4.4. Advantages of Gradle
1.4.5. Limitations of Gradle
1.5. Why sbt?
1.5.1. How sbt works
1.5.2. Plugin architecture vs. tasks
1.5.3. Phases versus task dependencies
1.5.4. Passing information around your build
1.5.5. Working with Scala
1.5.6. Multiproject builds
1.5.7. Dependency resolution
1.6. Interactivity/reactivity of sbt
1.6.1. Quicker compilation and testing cycle
1.6.2. Quicker compilation and testing cycle
1.6.3. sbt and the Scala REPL—the console command
1.7. Summary
2. Getting started
2.1. Setting up sbt
2.1.1. Setting the PATH in bash (for Linux/Mac)
2.1.2. Running sbt
2.2. Setting up a build
2.2.1. Tasks
2.2.2. Settings
2.3. Running code
2.4. Testing code
2.4.1. Running tasks when sources change
2.4.2. Selecting tests with interactive tasks
2.5. Summary
Part 2 UNDERSTANDING SBT’S CORE CONCEPTS
3. Core Concepts
3.1. Creating builds
3.2. Defining settings
3.2.1. Initializations
3.3. Creating and executing tasks
3.3.1. Task dependencies
3.4. Using configurations
3.5. Defining with subprojects
3.6. Putting it all together
3.7. Summary
4. The default build
4.1. Compiling your code
4.2. Finding your sources
4.2.1. Standard organization of sources
4.2.2. Testing sources
4.2.3. Custom organization of sources
4.2.4. Filtering the source you want
4.3. Depending on libraries
4.3.1. Unmanaged dependencies
4.3.2. Managed dependencies
4.3.3. Managed dependencies and configurations
4.4. Packaging your project
4.4.1. Identifying your project
4.5. Summary
Part 3 WORKING WITH SBT
5. Testing
5.1. Configuring Specs2 with sbt
5.1.1. Reports and forking tests
5.1.2. Digging deeper: other options for forking
5.2. JUnit and using custom code
5.2.1. Report generation with JUnit
5.3. ScalaCheck
5.4. Integration testing
5.4.1. ScalaTest and Selenium
5.4.2. Challenges of integration testing
5.4.3. Adding integration tests to sbt
5.5. Summary
6. The IO and Process Libraries
6.1. Packaging using processes
6.2. Packaging using the sbt.IO library
6.3. More mappings
6.4. Task dependencies
6.5. Logging using the sbt logger
6.6. Running your build using fork
6.7. Linking everything together: dependencies
6.8. Linking everything together: processes
6.9. Summary
7. Accepting user input
7.1. Accepting user input with input tasks
7.2. Defining an interface with parsers
7.3. Defining a database evolution parser
7.4. Helping the user with autocomplete
7.5. Summary
8. Using Plugins and external Libraries
8.1. Using plugins to check your code
8.2. Using the Revolver plugin to restart the application
8.3. Creating your uber jar using the assembly plugin
8.4. Including a library in your plugin build
8.5. Adding a plugin for use in all of your projects—signing your projects
8.6. Adding local credentials for deployment
8.7. Summary
9. Debugging your build
9.1. Running sbt
9.2. Making your build compile
9.3. Ensuring tasks are run
9.4. Resolving dependency conflicts
9.4.1. Fixing resolution failures
9.4.2. Fixing resolution conflicts
9.5. Summary
Part 4 EXTENDING SBT
10. Automating workflows with commands
10.1. Creating a simple command
10.2. Running tasks in parallel
10.3. Parsing input with commands
10.4. Creating useful help messages
10.5. Summary
11. Defining Plugins
11.1. Reusing code using Scala files
11.2. Introducing the AutoPlugin interface
11.2.1. Taking a closer look—the plugin definition
11.2.2. Taking a closer look—task and setting dependencies
11.3. Testing a plugin with the scripted plugin
11.4. Using configurations in your plugin
11.5. Adding incremental tasks
11.5.1. Adding incremental tasks with .previous—a sneak preview of 1.0
11.6. Making things easy for the user—more about the AutoPlugin interface
11.7. Summary
Part 5 DEPLOYING YOUR PROJECTS
12. Distributing Your Projects
12.1. Publishing a library
12.2. Publishing locally
12.3. Publishing a simple server
12.4. Generating a distribution
12.5. Creating a Linux distribution
12.6. Summary
Appendixes
Appendix A: What you need to know about Ivy
A.1. Modules
A.2. Module identification
A.3. Artifacts
A.4. Differences in Ivy and Maven
A.5. Configuration
A.6. Resolvers
A.7. Resolving dependency conflicts
Appendix B: Migrating to Autoplugins
B.1. Older sbt plugins
B.2. Migrating to autoplugins
Appendix C: Advanced setting/task API
C.1. Optional settings
C.2. Failing tasks
C.3. Dynamic tasks
C.4. Composing InputTasks

Covers core concepts using the Scala build tool. A useful read for beginners and advanced users alike. Iain Campbell, Tango Telecom

Offers a fast introduction to the basics of building software with sbt and complements it with detailed coverage of sbt’s more advanced topics. Dusan Kysel, Cyber Brain

Despite being a Java guy, I liked how the book tried to fool me into learning Scala. As I worked through the examples, I couldn’t help but start piecing some of it together. Eric Weinberg, Emprata

Erscheint lt. Verlag 4.12.2015
Verlagsort New York
Sprache englisch
Gewicht 472 g
Einbandart kartoniert
Themenwelt Mathematik / Informatik Informatik Software Entwicklung
Schlagworte Scala • Scala (Programmiersprache) • Scala Programming Language • Softwareentwicklung
ISBN-10 1-61729-127-7 / 1617291277
ISBN-13 978-1-61729-127-2 / 9781617291272
Zustand Neuware
Haben Sie eine Frage zum Produkt?
Mehr entdecken
aus dem Bereich