5

I want to use sbt to publish my project.

I'm used to maven, and need some help (mentally) transitioning.

By default I see 'publish' depends on 'package', but 'package' does not depend on 'test'. Of course I only want to publish tested code. How should I ensure this?

Of course I could make package depend on test, but the fact that this is not the default sort of suggests this is not idiomatic use of sbt. What would be the 'right' way to achieve this?

How do I find out more about best practices?

Community
  • 1
  • 1
Arnout Engelen
  • 6,709
  • 1
  • 25
  • 36

1 Answers1

5

I am always running sbt clean test publish-local publish (or publish-signed). This ensures any error that occurs before publish halts the process.

Another possibility would be to use the sbt-release plugin. This runs tests and also watches and adjusts your version strings.

0__
  • 66,707
  • 21
  • 171
  • 266
  • Thanks! Orchestrating this independently of the task dependencies with a tool like the sbt-release plugin indeed seems like a nice way to achieve this. Doesn't really protect us against people accidentally publishing without testing, but there's a trade-off there I suppose. – Arnout Engelen Aug 21 '15 at 11:48