Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Yes, it is.</p> <p>If you'd like to run them in the same VM the SBT is run in, then write a custom task similar to the following in your project definition file:</p> <pre><code> lazy val benchmark = task { // code to run benchmarks None // Some("will return an error message") } </code></pre> <p>Typing <code>benchmark</code> in SBT console will run the task above. To actually run the benchmarks, or, for that matter, any other class you've compiled, you can reuse some of the existing infrastructure of SBT, namely the method <code>runTask</code> which will create a task that runs something for you. It has the following signature:</p> <pre><code> def runTask(mainClass: =&gt; Option[String], classpath: PathFinder, options: String*): Task </code></pre> <p>Simply add the following to your file:</p> <pre><code> lazy val benchmark = task { args =&gt; runTask(Some("whatever.your.mainclass.is"), testClasspath, args) } </code></pre> <p>When running benchmarks, it is sometimes recommended that you run them in a separate jvm invocation, to get more reliable results. SBT allows you to run separate processes by invoking a method <code>!</code> on a string command. Say you have a command <code>java -jar path-to-artifact.jar</code> you want to run. Then:</p> <pre><code>"java -jar path-to-artifact.jar" ! </code></pre> <p>runs the command in SBT. You want to put the snippet above in a separate task, same as earlier.</p> <p>And don't forget to <code>reload</code> when you change your project definition.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload